summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <bilboed@bilboed.com>2016-05-19 11:06:26 +0200
committerEdward Hervey <bilboed@bilboed.com>2016-05-30 12:13:03 +0200
commit590522801ce2b461913801ed9a4b527d0e8b6be3 (patch)
treeef09361092e90ff8e817287cf5ce804826fa9630
parent18fc60cc40000665b14e29dc5f803b931a3558e6 (diff)
fixup: qtdemux: Use gst_adapter_get_offset
Instead of guessing the right offset of the moof, use the exact offset from the adapter.
-rw-r--r--gst/isomp4/qtdemux.c19
-rw-r--r--gst/isomp4/qtdemux.h2
-rw-r--r--tests/check/elements/qtdemux.c2
3 files changed, 11 insertions, 12 deletions
diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c
index 4d9722e19..03461982a 100644
--- a/gst/isomp4/qtdemux.c
+++ b/gst/isomp4/qtdemux.c
@@ -6094,8 +6094,6 @@ gst_qtdemux_chain (GstPad * sinkpad, GstObject * parent, GstBuffer * inbuf)
}
}
- demux->last_incoming_offset = GST_BUFFER_OFFSET (inbuf);
-
gst_adapter_push (demux->adapter, inbuf);
GST_DEBUG_OBJECT (demux,
@@ -6119,9 +6117,10 @@ gst_qtdemux_process_adapter (GstQTDemux * demux, gboolean force)
(ret == GST_FLOW_OK || (ret == GST_FLOW_NOT_LINKED && force))) {
GST_DEBUG_OBJECT (demux,
- "state:%s , demux->neededbytes:%d, demux->offset:%" G_GUINT64_FORMAT,
- qt_demux_state_string (demux->state), demux->neededbytes,
- demux->offset);
+ "state:%s , demux->neededbytes:%d, demux->offset:%" G_GUINT64_FORMAT
+ " adapter offset :%" G_GUINT64_FORMAT,
+ qt_demux_state_string (demux->state), demux->neededbytes, demux->offset,
+ gst_adapter_get_offset (demux->adapter));
switch (demux->state) {
case QTDEMUX_STATE_INITIAL:{
@@ -6330,11 +6329,11 @@ gst_qtdemux_process_adapter (GstQTDemux * demux, gboolean force)
GST_TIME_ARGS (demux->fragment_start));
}
GST_DEBUG_OBJECT (demux,
- "demux offset %" G_GUINT64_FORMAT " last incoming offset %"
- G_GUINT64_FORMAT, demux->offset, demux->last_incoming_offset);
- if (demux->upstream_format_is_time
- && demux->last_incoming_offset != GST_BUFFER_OFFSET_NONE)
- demux->moof_offset = demux->last_incoming_offset;
+ "demux offset %" G_GUINT64_FORMAT " adapter offset %"
+ G_GUINT64_FORMAT, demux->offset,
+ gst_adapter_get_offset (demux->adapter));
+ if (demux->upstream_format_is_time)
+ demux->moof_offset = gst_adapter_get_offset (demux->adapter);
else
demux->moof_offset = demux->offset;
if (!qtdemux_parse_moof (demux, data, demux->neededbytes,
diff --git a/gst/isomp4/qtdemux.h b/gst/isomp4/qtdemux.h
index 6cbd436ac..771ddcc5b 100644
--- a/gst/isomp4/qtdemux.h
+++ b/gst/isomp4/qtdemux.h
@@ -232,8 +232,6 @@ struct _GstQTDemux {
* header start.
* Note : This is not computed from the GST_BUFFER_OFFSET field */
guint64 fragment_start_offset;
- /* Buffer offset of the last incoming buffer */
- guint64 last_incoming_offset;
};
struct _GstQTDemuxClass {
diff --git a/tests/check/elements/qtdemux.c b/tests/check/elements/qtdemux.c
index 7579b2465..55d286208 100644
--- a/tests/check/elements/qtdemux.c
+++ b/tests/check/elements/qtdemux.c
@@ -103,6 +103,8 @@ GST_START_TEST (test_qtdemux_input_gap)
gst_buffer_fill (inbuf, 0, seg_1_m4f, seg_1_moof_size);
GST_BUFFER_PTS (inbuf) = 0;
GST_BUFFER_OFFSET (inbuf) = 0;
+ /* We are simulating that this fragment can happen at any point */
+ GST_BUFFER_FLAG_SET (inbuf, GST_BUFFER_FLAG_DISCONT);
GST_DEBUG ("Pushing trun buffer");
fail_unless (gst_pad_chain (sinkpad, inbuf) == GST_FLOW_OK);
fail_if (data.srcpad == NULL);