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> 2007-08-21 Wim Taymans <wim.taymans@gmail.com>
* gst/rtpmanager/gstrtpjitterbuffer.c: * 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 either audio or video is linked we return GST_FLOW_OK */
if (demux->audio_linked || demux->video_linked) { if (demux->audio_linked || demux->video_linked) {
ret = GST_FLOW_OK; 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); g_free (function_name);
if (demux->index) { if (demux->index && demux->times && demux->filepositions) {
/* If an index was found, insert associations */ /* If an index was found, insert associations */
for (i = 0; i < MIN (demux->times->len, demux->filepositions->len); i++) { for (i = 0; i < MIN (demux->times->len, demux->filepositions->len); i++) {
guint64 time, fileposition; 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_element_add_pad (GST_ELEMENT (demux),
gst_object_ref (demux->audio_pad)); gst_object_ref (demux->audio_pad));
if ((demux->has_audio & (demux->audio_pad != NULL)) && if ((demux->has_audio && !demux->audio_pad) ||
(demux->has_video & (demux->video_pad != NULL))) { (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_DEBUG_OBJECT (demux, "emitting no more pads");
gst_element_no_more_pads (GST_ELEMENT (demux)); gst_element_no_more_pads (GST_ELEMENT (demux));
} }
@ -556,13 +559,17 @@ gst_flv_parse_tag_audio (GstFLVDemux * demux, const guint8 * data,
} }
/* Push taglist if present */ /* Push taglist if present */
if ((demux->has_audio & (demux->audio_pad != NULL)) && if ((demux->has_audio && !demux->audio_pad) ||
(demux->has_video & (demux->video_pad != NULL)) && (demux->has_video && !demux->video_pad)) {
demux->taglist && demux->push_tags) { GST_DEBUG_OBJECT (demux, "we are still waiting for a stream to come up "
GST_DEBUG_OBJECT (demux, "pushing tags out"); "before we can push tags");
gst_element_found_tags (GST_ELEMENT (demux), demux->taglist); } else {
demux->taglist = gst_tag_list_new (); if (demux->taglist && demux->push_tags) {
demux->push_tags = FALSE; 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 */ /* Create buffer from pad */
@ -570,8 +577,8 @@ gst_flv_parse_tag_audio (GstFLVDemux * demux, const guint8 * data,
demux->tag_data_size - codec_data, GST_PAD_CAPS (demux->audio_pad), demux->tag_data_size - codec_data, GST_PAD_CAPS (demux->audio_pad),
&buffer); &buffer);
if (G_UNLIKELY (ret != GST_FLOW_OK)) { if (G_UNLIKELY (ret != GST_FLOW_OK)) {
GST_WARNING_OBJECT (demux, "failed allocating a %d bytes buffer", GST_WARNING_OBJECT (demux, "failed allocating a %" G_GUINT64_FORMAT
demux->tag_data_size); " bytes buffer: %s", demux->tag_data_size, gst_flow_get_name (ret));
if (ret == GST_FLOW_NOT_LINKED) { if (ret == GST_FLOW_NOT_LINKED) {
demux->audio_linked = FALSE; 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_element_add_pad (GST_ELEMENT (demux),
gst_object_ref (demux->video_pad)); gst_object_ref (demux->video_pad));
if ((demux->has_audio & (demux->audio_pad != NULL)) && if ((demux->has_audio && !demux->audio_pad) ||
(demux->has_video & (demux->video_pad != NULL))) { (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_DEBUG_OBJECT (demux, "emitting no more pads");
gst_element_no_more_pads (GST_ELEMENT (demux)); gst_element_no_more_pads (GST_ELEMENT (demux));
} }
@ -779,13 +789,17 @@ gst_flv_parse_tag_video (GstFLVDemux * demux, const guint8 * data,
} }
/* Push taglist if present */ /* Push taglist if present */
if ((demux->has_audio & (demux->audio_pad != NULL)) && if ((demux->has_audio && !demux->audio_pad) ||
(demux->has_video & (demux->video_pad != NULL)) && (demux->has_video && !demux->video_pad)) {
demux->taglist && demux->push_tags) { GST_DEBUG_OBJECT (demux, "we are still waiting for a stream to come up "
GST_DEBUG_OBJECT (demux, "pushing tags out"); "before we can push tags");
gst_element_found_tags (GST_ELEMENT (demux), demux->taglist); } else {
demux->taglist = gst_tag_list_new (); if (demux->taglist && demux->push_tags) {
demux->push_tags = FALSE; 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 */ /* Create buffer from pad */
@ -793,8 +807,8 @@ gst_flv_parse_tag_video (GstFLVDemux * demux, const guint8 * data,
demux->tag_data_size - codec_data, GST_PAD_CAPS (demux->video_pad), demux->tag_data_size - codec_data, GST_PAD_CAPS (demux->video_pad),
&buffer); &buffer);
if (G_UNLIKELY (ret != GST_FLOW_OK)) { if (G_UNLIKELY (ret != GST_FLOW_OK)) {
GST_WARNING_OBJECT (demux, "failed allocating a %d bytes buffer", GST_WARNING_OBJECT (demux, "failed allocating a %" G_GUINT64_FORMAT
demux->tag_data_size); " bytes buffer: %s", demux->tag_data_size, gst_flow_get_name (ret));
if (ret == GST_FLOW_NOT_LINKED) { if (ret == GST_FLOW_NOT_LINKED) {
demux->video_linked = FALSE; demux->video_linked = FALSE;
} }