From 6aa4d5df2df03ea06a0846ac38b54de6c1a6b19c Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Wed, 17 Feb 2010 11:36:13 +0100 Subject: [PATCH] flvdemux: fix setting DELTA_UNIT flag on outgoing buffers ... which should not depend on having index available or not. Also refactor resulting collapsed code. --- gst/flv/gstflvparse.c | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/gst/flv/gstflvparse.c b/gst/flv/gstflvparse.c index 86c638f..03302e2 100644 --- a/gst/flv/gstflvparse.c +++ b/gst/flv/gstflvparse.c @@ -1095,29 +1095,17 @@ gst_flv_parse_tag_video (GstFLVDemux * demux, GstBuffer * buffer) demux->duration < GST_BUFFER_TIMESTAMP (outbuf)) demux->duration = GST_BUFFER_TIMESTAMP (outbuf); - if (!demux->indexed) { - if (!keyframe) { - GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT); - if (demux->index && !demux->random_access) { - GST_LOG_OBJECT (demux, "adding association %" GST_TIME_FORMAT "-> %" - G_GUINT64_FORMAT, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)), - demux->cur_tag_offset); - gst_index_add_association (demux->index, demux->index_id, - GST_ASSOCIATION_FLAG_NONE, - GST_FORMAT_TIME, GST_BUFFER_TIMESTAMP (outbuf), - GST_FORMAT_BYTES, demux->cur_tag_offset, NULL); - } - } else { - if (demux->index && !demux->random_access) { - GST_LOG_OBJECT (demux, "adding association %" GST_TIME_FORMAT "-> %" - G_GUINT64_FORMAT, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)), - demux->cur_tag_offset); - gst_index_add_association (demux->index, demux->index_id, - GST_ASSOCIATION_FLAG_KEY_UNIT, - GST_FORMAT_TIME, GST_BUFFER_TIMESTAMP (outbuf), - GST_FORMAT_BYTES, demux->cur_tag_offset, NULL); - } - } + if (!keyframe) + GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT); + + if (!demux->indexed && demux->index && !demux->random_access) { + GST_LOG_OBJECT (demux, "adding association %" GST_TIME_FORMAT "-> %" + G_GUINT64_FORMAT, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)), + demux->cur_tag_offset); + gst_index_add_association (demux->index, demux->index_id, + keyframe ? GST_ASSOCIATION_FLAG_KEY_UNIT : GST_ASSOCIATION_FLAG_NONE, + GST_FORMAT_TIME, GST_BUFFER_TIMESTAMP (outbuf), + GST_FORMAT_BYTES, demux->cur_tag_offset, NULL); } if (G_UNLIKELY (demux->video_need_discont)) { -- 2.7.4