matroskademux: early sending pending codec-data for all streams

... at least before syncing across all streams might cause some gap
activity on any of those streams, notably sparse streams.

See also #712134
This commit is contained in:
Mark Nauwelaerts 2014-03-22 17:05:17 +01:00
parent 1e135a38cc
commit 9a30726226

View file

@ -2627,6 +2627,40 @@ gst_matroska_demux_push_dvd_clut_change_event (GstMatroskaDemux * demux,
g_free (buf);
}
static void
gst_matroska_demux_push_codec_data_all (GstMatroskaDemux * demux)
{
gint stream_nr;
GST_OBJECT_LOCK (demux);
g_assert (demux->common.num_streams == demux->common.src->len);
for (stream_nr = 0; stream_nr < demux->common.src->len; stream_nr++) {
GstMatroskaTrackContext *stream;
stream = g_ptr_array_index (demux->common.src, stream_nr);
if (stream->send_stream_headers) {
if (stream->stream_headers != NULL) {
gst_matroska_demux_push_stream_headers (demux, stream);
} else {
/* FIXME: perhaps we can just disable and skip this stream then */
GST_ELEMENT_ERROR (demux, STREAM, DECODE, (NULL),
("Failed to extract stream headers from codec private data"));
}
stream->send_stream_headers = FALSE;
}
if (stream->send_dvd_event) {
gst_matroska_demux_push_dvd_clut_change_event (demux, stream);
/* FIXME: should we send this event again after (flushing) seek ? */
stream->send_dvd_event = FALSE;
}
}
GST_OBJECT_UNLOCK (demux);
}
static GstFlowReturn
gst_matroska_demux_add_mpeg_seq_header (GstElement * element,
GstMatroskaTrackContext * stream, GstBuffer ** buf)
@ -3344,22 +3378,9 @@ gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux,
demux->segment_seqnum = 0;
}
if (stream->send_stream_headers) {
if (stream->stream_headers != NULL) {
ret = gst_matroska_demux_push_stream_headers (demux, stream);
} else {
/* FIXME: perhaps we can just disable and skip this stream then */
GST_ELEMENT_ERROR (demux, STREAM, DECODE, (NULL),
("Failed to extract stream headers from codec private data"));
}
stream->send_stream_headers = FALSE;
}
if (stream->send_dvd_event) {
gst_matroska_demux_push_dvd_clut_change_event (demux, stream);
/* FIXME: should we send this event again after (flushing) seek ? */
stream->send_dvd_event = FALSE;
}
/* send pending codec data headers for all streams,
* before we perform sync across all streams */
gst_matroska_demux_push_codec_data_all (demux);
if (block_duration != -1) {
if (stream->timecodescale == 1.0)