summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2016-06-07 21:04:21 -0400
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2016-06-07 21:42:11 -0400
commitc511e0c223817de89a85b5614c8c58c83ede2d00 (patch)
treed095bf0065e780565e8708287adc1be5a7e22aec /gst
parent4bcedb10f2202375f09b08f5c635393083a1ac17 (diff)
downloadgstreamer-plugins-bad-c511e0c223817de89a85b5614c8c58c83ede2d00.tar.gz
vmncdec: Wait for segment event before checking it
The heuristic to choose between packetise or not was changed to use the segment format. The problem is that this change is reading the segment during the caps event handling. The segment event will only be sent after. That prevented the decoder to go in packetize mode, and avoid useless parsing. https://bugzilla.gnome.org/show_bug.cgi?id=736252
Diffstat (limited to 'gst')
-rw-r--r--gst/vmnc/vmncdec.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/gst/vmnc/vmncdec.c b/gst/vmnc/vmncdec.c
index 34e63c7bc..550430287 100644
--- a/gst/vmnc/vmncdec.c
+++ b/gst/vmnc/vmncdec.c
@@ -41,6 +41,8 @@ static GstFlowReturn gst_vmnc_dec_handle_frame (GstVideoDecoder * decoder,
GstVideoCodecFrame * frame);
static GstFlowReturn gst_vmnc_dec_parse (GstVideoDecoder * decoder,
GstVideoCodecFrame * frame, GstAdapter * adapter, gboolean at_eos);
+static gboolean gst_vmnc_dec_sink_event (GstVideoDecoder * bdec,
+ GstEvent * event);
#define GST_CAT_DEFAULT vmnc_debug
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
@@ -89,6 +91,7 @@ gst_vmnc_dec_class_init (GstVMncDecClass * klass)
decoder_class->parse = gst_vmnc_dec_parse;
decoder_class->handle_frame = gst_vmnc_dec_handle_frame;
decoder_class->set_format = gst_vmnc_dec_set_format;
+ decoder_class->sink_event = gst_vmnc_dec_sink_event;
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&vmnc_dec_src_factory));
@@ -851,11 +854,6 @@ gst_vmnc_dec_set_format (GstVideoDecoder * decoder, GstVideoCodecState * state)
/* We require a format descriptor in-stream, so we ignore the info from the
* container here. We just use the framerate */
- if (decoder->input_segment.format == GST_FORMAT_TIME)
- gst_video_decoder_set_packetized (decoder, TRUE);
- else
- gst_video_decoder_set_packetized (decoder, FALSE);
-
if (dec->input_state)
gst_video_codec_state_unref (dec->input_state);
dec->input_state = gst_video_codec_state_ref (state);
@@ -863,6 +861,26 @@ gst_vmnc_dec_set_format (GstVideoDecoder * decoder, GstVideoCodecState * state)
return TRUE;
}
+static gboolean
+gst_vmnc_dec_sink_event (GstVideoDecoder * bdec, GstEvent * event)
+{
+ const GstSegment *segment;
+
+ if (GST_EVENT_TYPE (event) != GST_EVENT_SEGMENT)
+ goto done;
+
+ gst_event_parse_segment (event, &segment);
+
+ if (segment->format == GST_FORMAT_TIME)
+ gst_video_decoder_set_packetized (bdec, TRUE);
+ else
+ gst_video_decoder_set_packetized (bdec, FALSE);
+
+done:
+ return GST_VIDEO_DECODER_CLASS (gst_vmnc_dec_parent_class)->sink_event (bdec,
+ event);
+}
+
static GstFlowReturn
gst_vmnc_dec_handle_frame (GstVideoDecoder * decoder,
GstVideoCodecFrame * frame)