mirror of
https://github.com/pion/mediadevices.git
synced 2025-09-27 04:46:10 +08:00
Compare commits
1 Commits
427feefb33
...
vpx-suppor
Author | SHA1 | Date | |
---|---|---|---|
![]() |
bb7611783d |
@@ -17,6 +17,13 @@ type Params struct {
|
|||||||
RateControlMinQuantizer uint
|
RateControlMinQuantizer uint
|
||||||
RateControlMaxQuantizer uint
|
RateControlMaxQuantizer uint
|
||||||
ErrorResilient ErrorResilientMode
|
ErrorResilient ErrorResilientMode
|
||||||
|
TemporalLayers []TemporalLayer
|
||||||
|
}
|
||||||
|
|
||||||
|
// TemporalLayer represents temporal layer config.
|
||||||
|
type TemporalLayer struct {
|
||||||
|
TargetBitrate uint // in kbps
|
||||||
|
RateDecimator uint
|
||||||
}
|
}
|
||||||
|
|
||||||
// RateControlMode represents rate control mode.
|
// RateControlMode represents rate control mode.
|
||||||
|
@@ -180,6 +180,12 @@ func newEncoder(r video.Reader, p prop.Media, params Params, codecIface *C.vpx_c
|
|||||||
cfg.rc_resize_allowed = 0
|
cfg.rc_resize_allowed = 0
|
||||||
cfg.g_pass = C.VPX_RC_ONE_PASS
|
cfg.g_pass = C.VPX_RC_ONE_PASS
|
||||||
|
|
||||||
|
cfg.ts_number_layers = C.uint(len(params.TemporalLayers))
|
||||||
|
for i := range params.TemporalLayers {
|
||||||
|
cfg.ts_target_bitrate[i] = C.uint(params.TemporalLayers[i].TargetBitrate)
|
||||||
|
cfg.ts_rate_decimator[i] = C.uint(params.TemporalLayers[i].RateDecimator)
|
||||||
|
}
|
||||||
|
|
||||||
raw := &C.vpx_image_t{}
|
raw := &C.vpx_image_t{}
|
||||||
if C.vpx_img_alloc(raw, C.VPX_IMG_FMT_I420, cfg.g_w, cfg.g_h, 1) == nil {
|
if C.vpx_img_alloc(raw, C.VPX_IMG_FMT_I420, cfg.g_w, cfg.g_h, 1) == nil {
|
||||||
return nil, errors.New("vpx_img_alloc failed")
|
return nil, errors.New("vpx_img_alloc failed")
|
||||||
|
Reference in New Issue
Block a user