Fix live bitrate
This commit is contained in:
parent
3edbafb637
commit
41085b1583
2 changed files with 5 additions and 2 deletions
|
@ -101,7 +101,7 @@ class MuxingSession extends EventEmitter {
|
||||||
this.fps = options.fps
|
this.fps = options.fps
|
||||||
|
|
||||||
this.bitrate = options.bitrate
|
this.bitrate = options.bitrate
|
||||||
this.ratio = options.bitrate
|
this.ratio = options.ratio
|
||||||
|
|
||||||
this.allResolutions = options.allResolutions
|
this.allResolutions = options.allResolutions
|
||||||
|
|
||||||
|
|
|
@ -237,5 +237,8 @@ export {
|
||||||
function capBitrate (inputBitrate: number, targetBitrate: number) {
|
function capBitrate (inputBitrate: number, targetBitrate: number) {
|
||||||
if (!inputBitrate) return targetBitrate
|
if (!inputBitrate) return targetBitrate
|
||||||
|
|
||||||
return Math.min(targetBitrate, inputBitrate)
|
// Add 30% margin to input bitrate
|
||||||
|
const inputBitrateWithMargin = inputBitrate + (inputBitrate * 0.3)
|
||||||
|
|
||||||
|
return Math.min(targetBitrate, inputBitrateWithMargin)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue