diff options
author | Chocobozzz <me@florianbigard.com> | 2021-10-11 15:59:15 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-10-11 15:59:38 +0200 |
commit | 41085b1583ade5ea1bb1d69965a62b98cf012209 (patch) | |
tree | 31c5289675847a734f9acfbdc9fc0a78cc26c0a8 | |
parent | 3edbafb6377cfb65bca3964d46fa27bc9f813300 (diff) | |
download | PeerTube-41085b1583ade5ea1bb1d69965a62b98cf012209.tar.gz PeerTube-41085b1583ade5ea1bb1d69965a62b98cf012209.tar.zst PeerTube-41085b1583ade5ea1bb1d69965a62b98cf012209.zip |
Fix live bitrate
-rw-r--r-- | server/lib/live/shared/muxing-session.ts | 2 | ||||
-rw-r--r-- | server/lib/transcoding/video-transcoding-profiles.ts | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/server/lib/live/shared/muxing-session.ts b/server/lib/live/shared/muxing-session.ts index a6907142d..b52363af7 100644 --- a/server/lib/live/shared/muxing-session.ts +++ b/server/lib/live/shared/muxing-session.ts | |||
@@ -101,7 +101,7 @@ class MuxingSession extends EventEmitter { | |||
101 | this.fps = options.fps | 101 | this.fps = options.fps |
102 | 102 | ||
103 | this.bitrate = options.bitrate | 103 | this.bitrate = options.bitrate |
104 | this.ratio = options.bitrate | 104 | this.ratio = options.ratio |
105 | 105 | ||
106 | this.allResolutions = options.allResolutions | 106 | this.allResolutions = options.allResolutions |
107 | 107 | ||
diff --git a/server/lib/transcoding/video-transcoding-profiles.ts b/server/lib/transcoding/video-transcoding-profiles.ts index a8176dca5..848b823e6 100644 --- a/server/lib/transcoding/video-transcoding-profiles.ts +++ b/server/lib/transcoding/video-transcoding-profiles.ts | |||
@@ -237,5 +237,8 @@ export { | |||
237 | function capBitrate (inputBitrate: number, targetBitrate: number) { | 237 | function capBitrate (inputBitrate: number, targetBitrate: number) { |
238 | if (!inputBitrate) return targetBitrate | 238 | if (!inputBitrate) return targetBitrate |
239 | 239 | ||
240 | return Math.min(targetBitrate, inputBitrate) | 240 | // Add 30% margin to input bitrate |
241 | const inputBitrateWithMargin = inputBitrate + (inputBitrate * 0.3) | ||
242 | |||
243 | return Math.min(targetBitrate, inputBitrateWithMargin) | ||
241 | } | 244 | } |