[FFmpeg-devel] rtsp.c udp_read_packet() fails to return when stream ends, simple fix
Sam Gerstein
sgerstein
Thu Mar 25 22:25:16 CET 2010
On Thu, Mar 25, 2010 at 3:12 PM, Ronald S. Bultje <rsbultje at gmail.com> wrote:
> int timeout_cnt = 0 can go in the variable declaration.
Check. I was thinking this project didn't like that sort of thing.
> max_timeouts can be a define since it's constant (so #define at top).
I wrote it with the idea that the timeout would be changed to runtime
configuration. I suppose I can make it a variable if/when I do that
:) now a #define.
Regarding Martin's question about the value, I think as short as
reasonable is the way I'd like to go. I could make it configurable,
but I'll have to take the time to figure out how to do that. 10s okay
for now?
>> + ? ? ? ?} else if (n == 0) {
>> + ? ? ? ? ? ?/* select() timed out */
>> + ? ? ? ? ? ?if (++timeout_cnt >= max_timeouts) {
>> + ? ? ? ? ? ? ? ?return AVERROR(ETIME);
>> + ? ? ? ? ? ?}
>> + ? ? ? ?} else {
>> + ? ? ? ? ? ?if (errno != EINTR) {
>> + ? ? ? ? ? ? ? ?/* select() encountered an error*/
>> + ? ? ? ? ? ? ? ?return AVERROR(errno);
>> + ? ? ? ? ? ?}
>
> } else if (n == 0 && ++timeout_cnt >= MAX_TIMEOUTS) {
> ? ?return AVERROR(ETIME);
> } else if (errno != EINTR)
> ? ?return errno;
>
> 4 lines instead of 10. :-).
That doesn't mean the same thing. I kept my nested ifs separate to
avoid exactly that kind of problem.
You prefer I remove the comments?
/Sam
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rtsp_timeout.diff
Type: application/octet-stream
Size: 1745 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100325/27ac8ac8/attachment.obj>
More information about the ffmpeg-devel
mailing list