gst/rawparse/gstrawparse.c: Improve handling of unknown or too small upstream sizes in pull mode.

Original commit message from CVS:
* gst/rawparse/gstrawparse.c: (gst_raw_parse_loop):
Improve handling of unknown or too small upstream sizes in
pull mode.
diff --git a/ChangeLog b/ChangeLog
index dc3c321..318a6d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2008-01-19  Sebastian Dröge  <slomo@circular-chaos.org>
 
+	* gst/rawparse/gstrawparse.c: (gst_raw_parse_loop):
+	Improve handling of unknown or too small upstream sizes in
+	pull mode.
+
+2008-01-19  Sebastian Dröge  <slomo@circular-chaos.org>
+
 	* gst/rawparse/gstrawparse.c: (gst_raw_parse_loop),
 	(gst_raw_parse_handle_seek_push):
 	Improve debugging a bit and for handling multiple frames per buffer
diff --git a/gst/rawparse/gstrawparse.c b/gst/rawparse/gstrawparse.c
index 16a6b9f..be7549b 100644
--- a/gst/rawparse/gstrawparse.c
+++ b/gst/rawparse/gstrawparse.c
@@ -304,13 +304,14 @@
   if (rp->offset + size > rp->upstream_length) {
     GstFormat fmt = GST_FORMAT_BYTES;
 
-    if (!gst_pad_query_peer_duration (rp->sinkpad, &fmt, &rp->upstream_length)
-        || rp->upstream_length < rp->offset + rp->framesize) {
+    if (!gst_pad_query_peer_duration (rp->sinkpad, &fmt, &rp->upstream_length)) {
+      GST_WARNING_OBJECT (rp,
+          "Could not get upstream duration, trying to pull frame by frame");
+      size = rp->framesize;
+    } else if (rp->upstream_length < rp->offset + rp->framesize) {
       ret = GST_FLOW_UNEXPECTED;
       goto pause;
-    }
-
-    if (rp->offset + size > rp->upstream_length) {
+    } else if (rp->offset + size > rp->upstream_length) {
       size = rp->upstream_length - rp->offset;
       size -= size % rp->framesize;
     }