Add MaximumBufferSize

This commit is contained in:
Atsushi Watanabe
2025-10-21 13:38:35 +09:00
parent ffe2fcb74d
commit 5e91c919df
2 changed files with 3 additions and 0 deletions
+2
View File
@@ -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
}
+1
View File
@@ -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)