summaryrefslogtreecommitdiff
path: root/ext/openh264
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2016-06-30 23:02:49 +0200
committerSebastian Dröge <sebastian@centricular.com>2016-06-30 23:30:13 +0200
commit4cba0d5faba52af30c9bb3e4d81cafde9fde6c41 (patch)
tree9dfa60714e0127e7884a4c1f51bbb0db1077a3eb /ext/openh264
parent71c9cdeff4b2994616dc6c54f5f5cf3233c8e166 (diff)
openh264enc: Make slice settings more explicit and don't set any number if not a fixed number of slices is selected
Diffstat (limited to 'ext/openh264')
-rw-r--r--ext/openh264/gstopenh264enc.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/ext/openh264/gstopenh264enc.cpp b/ext/openh264/gstopenh264enc.cpp
index 295153792..1d7cea515 100644
--- a/ext/openh264/gstopenh264enc.cpp
+++ b/ext/openh264/gstopenh264enc.cpp
@@ -105,7 +105,7 @@ static GType
gst_openh264enc_slice_mode_get_type (void)
{
static const GEnumValue types[] = {
- {SM_FIXEDSLCNUM_SLICE, "num-slices slices", "n-slices"},
+ {SM_FIXEDSLCNUM_SLICE, "Fixed number of slices", "n-slices"},
{SM_AUTO_SLICE, "Number of slices equal to number of threads", "auto"},
{0, NULL, NULL},
};
@@ -680,9 +680,16 @@ gst_openh264enc_set_format (GstVideoEncoder * encoder,
enc_params.sSpatialLayers[0].iVideoHeight = height;
enc_params.sSpatialLayers[0].fFrameRate = fps_n * 1.0 / fps_d;
enc_params.sSpatialLayers[0].iSpatialBitrate = openh264enc->bitrate;
- enc_params.sSpatialLayers[0].sSliceCfg.uiSliceMode = openh264enc->slice_mode;
- enc_params.sSpatialLayers[0].sSliceCfg.sSliceArgument.uiSliceNum =
- openh264enc->num_slices;
+
+ if (openh264enc->slice_mode == SM_FIXEDSLCNUM_SLICE) {
+ if (openh264enc->num_slices == 1)
+ enc_params.sSpatialLayers[0].sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
+ else
+ enc_params.sSpatialLayers[0].sSliceCfg.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
+ enc_params.sSpatialLayers[0].sSliceCfg.sSliceArgument.uiSliceNum = openh264enc->num_slices;
+ } else {
+ enc_params.sSpatialLayers[0].sSliceCfg.uiSliceMode = openh264enc->slice_mode;
+ }
openh264enc->framerate = (1 + fps_n / fps_d);