summaryrefslogtreecommitdiffstats
path: root/gst/flv
diff options
context:
space:
mode:
authorJulien Moutte <julien@moutte.net>2007-08-22 14:03:42 +0000
committerJulien Moutte <julien@moutte.net>2007-08-22 14:03:42 +0000
commit79a984c303998dd0ca17f4cc64f5e4321522d575 (patch)
treec5d1199570b7164ca1677f80f72c96c572bce990 /gst/flv
parent2edfcea585ee1ef195ca2ebad81f546a506a2ba0 (diff)
downloadgst-plugins-bad-79a984c303998dd0ca17f4cc64f5e4321522d575.tar.gz
gst-plugins-bad-79a984c303998dd0ca17f4cc64f5e4321522d575.tar.bz2
gst-plugins-bad-79a984c303998dd0ca17f4cc64f5e4321522d575.zip
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.
Diffstat (limited to 'gst/flv')
-rw-r--r--gst/flv/gstflvdemux.c3
-rw-r--r--gst/flv/gstflvparse.c60
2 files changed, 40 insertions, 23 deletions
diff --git a/gst/flv/gstflvdemux.c b/gst/flv/gstflvdemux.c
index 3f727f1c..3a644c38 100644
--- a/gst/flv/gstflvdemux.c
+++ b/gst/flv/gstflvdemux.c
@@ -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");
}
}
diff --git a/gst/flv/gstflvparse.c b/gst/flv/gstflvparse.c
index 1421f8d4..dd7794d1 100644
--- a/gst/flv/gstflvparse.c
+++ b/gst/flv/gstflvparse.c
@@ -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,13 +559,17 @@ 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) {
- 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;
+ 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 */
@@ -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),
&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,13 +789,17 @@ 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) {
- 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;
+ 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 */
@@ -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),
&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;
}