qtdemux: don't assert if upstream size is not available when guessing bitrates
authorTim-Philipp Müller <tim@centricular.net>
Fri, 12 Oct 2012 23:03:29 +0000 (00:03 +0100)
committerTim-Philipp Müller <tim@centricular.net>
Fri, 12 Oct 2012 23:08:01 +0000 (00:08 +0100)
Fixes abort in push mode where the source is not seekable and the
size of the file is not available, as with

  cat foo.mp4 | gst-launch-1.0 playbin uri=fd://0

Less noticable with releases, since we disable all
g_assert() there.

https://bugzilla.gnome.org/show_bug.cgi?id=686008

gst/isomp4/qtdemux.c

index 50dc123..7c9b5a8 100644 (file)
@@ -7636,7 +7636,8 @@ gst_qtdemux_guess_bitrate (GstQTDemux * qtdemux)
 
   GST_DEBUG_OBJECT (qtdemux, "Looking for streams with unknown bitrate");
 
-  if (!gst_pad_peer_query_duration (qtdemux->sinkpad, GST_FORMAT_BYTES, &size)) {
+  if (!gst_pad_peer_query_duration (qtdemux->sinkpad, GST_FORMAT_BYTES, &size)
+      || size <= 0) {
     GST_DEBUG_OBJECT (qtdemux,
         "Size in bytes of the stream not known - bailing");
     return;
@@ -7645,7 +7646,10 @@ gst_qtdemux_guess_bitrate (GstQTDemux * qtdemux)
   /* Subtract the header size */
   GST_DEBUG_OBJECT (qtdemux, "Total size %" G_GINT64_FORMAT ", header size %u",
       size, qtdemux->header_size);
-  g_assert (size >= qtdemux->header_size);
+
+  if (size < qtdemux->header_size)
+    return;
+
   size = size - qtdemux->header_size;
 
   if (!gst_qtdemux_get_duration (qtdemux, &duration) ||