[FFmpeg-devel] rtsp.c udp_read_packet() fails to return when stream ends, simple fix

Sam Gerstein sgerstein
Wed Mar 24 18:42:48 CET 2010


Hi folks,
I've seen this discussed here and there, but not submitted as a patch; it's
simple enough that I'm proposing it, and hoping someone familiar with the
module will review and comment.  This solution solves the problem I have,
but I wonder if it would be problematic in case of, eg. a flaky connection.

The problem:
when udp_read_packet calls select() to look for new data on its sockets, it
only handles the case where some socket signals.  Non-positive return values
from select() are ignored, ie. timeouts are ignored and the function
continues to loop looking for data.

The trivial solution:
{see patch below}

Questions:
-Is there a case where we would like to continue looping when a timeout
occurs?  a flaky connection?
  - if so, how about making a fixed number of tries before giving up?
-Should the timeout be adjusted from its current value of 100ms?


Index: libavformat/rtsp.c
===================================================================
--- libavformat/rtsp.c (revision 22644)
+++ libavformat/rtsp.c (working copy)
@@ -1676,6 +1676,9 @@
                     return 0;
             }
 #endif
+        } else {
+          /* select returned non-positive; timeout or error */
+          return -1;
         }
     }
 }



Regards,
Sam



More information about the ffmpeg-devel mailing list