From: Sebastian Dröge Date: Thu, 30 Jun 2016 21:02:49 +0000 (+0200) Subject: openh264enc: Make slice settings more explicit and don't set any number if not a... X-Git-Tag: 1.19.3~507^2~6384 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4cba0d5faba52af30c9bb3e4d81cafde9fde6c41;p=platform%2Fupstream%2Fgstreamer.git openh264enc: Make slice settings more explicit and don't set any number if not a fixed number of slices is selected --- diff --git a/ext/openh264/gstopenh264enc.cpp b/ext/openh264/gstopenh264enc.cpp index 2951537..1d7cea5 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);