From: Sebastian Dröge Date: Thu, 29 Jan 2009 14:55:44 +0000 (+0100) Subject: Only push buffers for pads that are not more than 500ms before other pads X-Git-Tag: 1.19.3~507^2~19621 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2dbe7063302eb8140652efe46a29cf411c2e978d;p=platform%2Fupstream%2Fgstreamer.git Only push buffers for pads that are not more than 500ms before other pads --- diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c index afd541a..eac597f 100644 --- a/gst/mxf/mxfdemux.c +++ b/gst/mxf/mxfdemux.c @@ -609,11 +609,11 @@ gst_mxf_demux_choose_package (GstMXFDemux * demux) for (i = 0; i < demux->preface->content_storage->n_packages; i++) { if (demux->preface->content_storage->packages[i] && - MXF_IS_METADATA_MATERIAL_PACKAGE (demux->preface-> - content_storage->packages[i])) { + MXF_IS_METADATA_MATERIAL_PACKAGE (demux->preface->content_storage-> + packages[i])) { ret = - MXF_METADATA_GENERIC_PACKAGE (demux->preface-> - content_storage->packages[i]); + MXF_METADATA_GENERIC_PACKAGE (demux->preface->content_storage-> + packages[i]); break; } } @@ -1257,8 +1257,8 @@ gst_mxf_demux_pad_next_component (GstMXFDemux * demux, GstMXFDemuxPad * pad) pad->current_component_index); pad->current_component = - MXF_METADATA_SOURCE_CLIP (sequence-> - structural_components[pad->current_component_index]); + MXF_METADATA_SOURCE_CLIP (sequence->structural_components[pad-> + current_component_index]); if (pad->current_component == NULL) { GST_ERROR_OBJECT (demux, "No such structural component"); return GST_FLOW_ERROR; @@ -1266,8 +1266,8 @@ gst_mxf_demux_pad_next_component (GstMXFDemux * demux, GstMXFDemuxPad * pad) if (!pad->current_component->source_package || !pad->current_component->source_package->top_level - || !MXF_METADATA_GENERIC_PACKAGE (pad-> - current_component->source_package)->tracks) { + || !MXF_METADATA_GENERIC_PACKAGE (pad->current_component-> + source_package)->tracks) { GST_ERROR_OBJECT (demux, "Invalid component"); return GST_FLOW_ERROR; } @@ -1492,6 +1492,7 @@ gst_mxf_demux_handle_generic_container_essence_element (GstMXFDemux * demux, for (i = 0; i < demux->src->len; i++) { GstMXFDemuxPad *pad = g_ptr_array_index (demux->src, i); + guint j; if (pad->current_essence_track != etrack) continue; @@ -1506,6 +1507,19 @@ gst_mxf_demux_handle_generic_container_essence_element (GstMXFDemux * demux, continue; } + for (j = 0; j < demux->src->len; j++) { + GstMXFDemuxPad *opad = g_ptr_array_index (demux->src, j); + + if (!opad->eos && opad->last_stop < pad->last_stop && + pad->last_stop - opad->last_stop > 500 * GST_MSECOND) { + break; + } + } + if (j != demux->src->len) { + GST_DEBUG_OBJECT (demux, "Pad is too far ahead of time"); + continue; + } + /* Create another subbuffer to have writable metadata */ outbuf = gst_buffer_create_sub (inbuf, 0, GST_BUFFER_SIZE (inbuf)); @@ -1582,7 +1596,6 @@ gst_mxf_demux_handle_generic_container_essence_element (GstMXFDemux * demux, } if (ret == GST_FLOW_UNEXPECTED) { - gboolean eos = TRUE; GST_DEBUG_OBJECT (demux, "EOS for track"); pad->eos = TRUE; @@ -1591,15 +1604,15 @@ gst_mxf_demux_handle_generic_container_essence_element (GstMXFDemux * demux, for (i = 0; i < demux->src->len; i++) { GstMXFDemuxPad *opad = g_ptr_array_index (demux->src, i); - eos &= opad->eos; + if (!opad->eos) { + ret = GST_FLOW_OK; + break; + } } - if (eos) { + if (ret == GST_FLOW_UNEXPECTED) { GST_DEBUG_OBJECT (demux, "All tracks are EOS"); - ret = GST_FLOW_UNEXPECTED; break; - } else { - ret = GST_FLOW_OK; } }