gst/flv/: Make sure we don't try filling up the index if no times object was parsed. Fix the way we decide to push ta...

Original commit message from CVS:
2007-08-22  Julien MOUTTE  <julien@moutte.net>

* gst/flv/gstflvdemux.c: (gst_flv_demux_pull_tag):
* gst/flv/gstflvparse.c: (gst_flv_parse_metadata_item),
(gst_flv_parse_tag_script), (gst_flv_parse_tag_audio),
(gst_flv_parse_tag_video): Make sure we don't try filling up the
index if no times object was parsed. Fix the way we decide to
push
tags and emit no-more-pads. Fix some printf typing in debugging.
This commit is contained in:
Julien Moutte 2007-08-22 14:03:42 +00:00
parent 2edfcea585
commit 79a984c303
3 changed files with 49 additions and 23 deletions

View file

@ -1,3 +1,12 @@
2007-08-22 Julien MOUTTE <julien@moutte.net>
* gst/flv/gstflvdemux.c: (gst_flv_demux_pull_tag):
* gst/flv/gstflvparse.c: (gst_flv_parse_metadata_item),
(gst_flv_parse_tag_script), (gst_flv_parse_tag_audio),
(gst_flv_parse_tag_video): Make sure we don't try filling up the
index if no times object was parsed. Fix the way we decide to push
tags and emit no-more-pads. Fix some printf typing in debugging.
2007-08-21 Wim Taymans <wim.taymans@gmail.com>
* gst/rtpmanager/gstrtpjitterbuffer.c:

View file

@ -332,6 +332,9 @@ gst_flv_demux_pull_tag (GstPad * pad, GstFLVDemux * demux)
/* If either audio or video is linked we return GST_FLOW_OK */
if (demux->audio_linked || demux->video_linked) {
ret = GST_FLOW_OK;
} else {
GST_WARNING_OBJECT (demux, "parsing this tag returned not-linked and "
"neither video nor audio are linked");
}
}

View file

@ -359,7 +359,7 @@ gst_flv_parse_tag_script (GstFLVDemux * demux, const guint8 * data,
g_free (function_name);
if (demux->index) {
if (demux->index && demux->times && demux->filepositions) {
/* If an index was found, insert associations */
for (i = 0; i < MIN (demux->times->len, demux->filepositions->len); i++) {
guint64 time, fileposition;
@ -507,8 +507,11 @@ gst_flv_parse_tag_audio (GstFLVDemux * demux, const guint8 * data,
gst_element_add_pad (GST_ELEMENT (demux),
gst_object_ref (demux->audio_pad));
if ((demux->has_audio & (demux->audio_pad != NULL)) &&
(demux->has_video & (demux->video_pad != NULL))) {
if ((demux->has_audio && !demux->audio_pad) ||
(demux->has_video && !demux->video_pad)) {
GST_DEBUG_OBJECT (demux, "we are still waiting for a stream to come up "
"before we can emit no more pads");
} else {
GST_DEBUG_OBJECT (demux, "emitting no more pads");
gst_element_no_more_pads (GST_ELEMENT (demux));
}
@ -556,22 +559,26 @@ gst_flv_parse_tag_audio (GstFLVDemux * demux, const guint8 * data,
}
/* Push taglist if present */
if ((demux->has_audio & (demux->audio_pad != NULL)) &&
(demux->has_video & (demux->video_pad != NULL)) &&
demux->taglist && demux->push_tags) {
if ((demux->has_audio && !demux->audio_pad) ||
(demux->has_video && !demux->video_pad)) {
GST_DEBUG_OBJECT (demux, "we are still waiting for a stream to come up "
"before we can push tags");
} else {
if (demux->taglist && demux->push_tags) {
GST_DEBUG_OBJECT (demux, "pushing tags out");
gst_element_found_tags (GST_ELEMENT (demux), demux->taglist);
demux->taglist = gst_tag_list_new ();
demux->push_tags = FALSE;
}
}
/* Create buffer from pad */
ret = gst_pad_alloc_buffer (demux->audio_pad, GST_BUFFER_OFFSET_NONE,
demux->tag_data_size - codec_data, GST_PAD_CAPS (demux->audio_pad),
&buffer);
if (G_UNLIKELY (ret != GST_FLOW_OK)) {
GST_WARNING_OBJECT (demux, "failed allocating a %d bytes buffer",
demux->tag_data_size);
GST_WARNING_OBJECT (demux, "failed allocating a %" G_GUINT64_FORMAT
" bytes buffer: %s", demux->tag_data_size, gst_flow_get_name (ret));
if (ret == GST_FLOW_NOT_LINKED) {
demux->audio_linked = FALSE;
}
@ -733,8 +740,11 @@ gst_flv_parse_tag_video (GstFLVDemux * demux, const guint8 * data,
gst_element_add_pad (GST_ELEMENT (demux),
gst_object_ref (demux->video_pad));
if ((demux->has_audio & (demux->audio_pad != NULL)) &&
(demux->has_video & (demux->video_pad != NULL))) {
if ((demux->has_audio && !demux->audio_pad) ||
(demux->has_video && !demux->video_pad)) {
GST_DEBUG_OBJECT (demux, "we are still waiting for a stream to come up "
"before we can emit no more pads");
} else {
GST_DEBUG_OBJECT (demux, "emitting no more pads");
gst_element_no_more_pads (GST_ELEMENT (demux));
}
@ -779,22 +789,26 @@ gst_flv_parse_tag_video (GstFLVDemux * demux, const guint8 * data,
}
/* Push taglist if present */
if ((demux->has_audio & (demux->audio_pad != NULL)) &&
(demux->has_video & (demux->video_pad != NULL)) &&
demux->taglist && demux->push_tags) {
if ((demux->has_audio && !demux->audio_pad) ||
(demux->has_video && !demux->video_pad)) {
GST_DEBUG_OBJECT (demux, "we are still waiting for a stream to come up "
"before we can push tags");
} else {
if (demux->taglist && demux->push_tags) {
GST_DEBUG_OBJECT (demux, "pushing tags out");
gst_element_found_tags (GST_ELEMENT (demux), demux->taglist);
demux->taglist = gst_tag_list_new ();
demux->push_tags = FALSE;
}
}
/* Create buffer from pad */
ret = gst_pad_alloc_buffer (demux->video_pad, GST_BUFFER_OFFSET_NONE,
demux->tag_data_size - codec_data, GST_PAD_CAPS (demux->video_pad),
&buffer);
if (G_UNLIKELY (ret != GST_FLOW_OK)) {
GST_WARNING_OBJECT (demux, "failed allocating a %d bytes buffer",
demux->tag_data_size);
GST_WARNING_OBJECT (demux, "failed allocating a %" G_GUINT64_FORMAT
" bytes buffer: %s", demux->tag_data_size, gst_flow_get_name (ret));
if (ret == GST_FLOW_NOT_LINKED) {
demux->video_linked = FALSE;
}