mirror of
https://github.com/pion/mediadevices.git
synced 2026-04-22 15:57:27 +08:00
Add MaximumBufferSize
This commit is contained in:
@@ -20,6 +20,7 @@ type Params struct {
|
||||
|
||||
StartingBufferLevel time.Duration
|
||||
OptimalBufferLevel time.Duration
|
||||
MaximumBufferSize time.Duration
|
||||
}
|
||||
|
||||
// NewParams returns default x264 codec specific parameters.
|
||||
@@ -31,6 +32,7 @@ func NewParams() (Params, error) {
|
||||
Preset: 9,
|
||||
StartingBufferLevel: 400 * time.Millisecond,
|
||||
OptimalBufferLevel: 200 * time.Millisecond,
|
||||
MaximumBufferSize: 500 * time.Millisecond,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ func newEncoder(r video.Reader, p prop.Media, params Params) (codec.ReadCloser,
|
||||
enc.param.intra_period_length = C.int32_t(params.KeyFrameInterval)
|
||||
enc.param.starting_buffer_level_ms = C.int64_t(params.StartingBufferLevel.Milliseconds())
|
||||
enc.param.optimal_buffer_level_ms = C.int64_t(params.OptimalBufferLevel.Milliseconds())
|
||||
enc.param.maximum_buffer_size_ms = C.int64_t(params.MaximumBufferSize.Milliseconds())
|
||||
|
||||
if err := errFromC(C.enc_init(enc)); err != nil {
|
||||
_ = C.enc_free(enc)
|
||||
|
||||
Reference in New Issue
Block a user