diff mbox

[FFmpeg-devel] rtsp: only break on parse_rtsp_message on error

Message ID 20171201210915.18571-1-tmatth@videolan.org
State Accepted
Commit f6161fccf8c5720ceac1ed1df8ba60ff8fed69f5
Headers show

Commit Message

Tristan Matthews Dec. 1, 2017, 9:09 p.m. UTC
Fix suggested by Luca Barbato.

This was causing spurious EOFs when using -rtsp_transport udp, as
reported in https://bugzilla.libav.org/show_bug.cgi?id=1103
---
 libavformat/rtsp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer Dec. 2, 2017, 4:01 p.m. UTC | #1
On Fri, Dec 01, 2017 at 04:09:15PM -0500, Tristan Matthews wrote:
> Fix suggested by Luca Barbato.
> 
> This was causing spurious EOFs when using -rtsp_transport udp, as
> reported in https://bugzilla.libav.org/show_bug.cgi?id=1103
> ---
>  libavformat/rtsp.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

where is the code which interprets 0 as EOF ?
also nicolas may want to look at this, he was working on EOF vs 0 issues
(thus ccing nicolas)

thanks

[...]
Tristan Matthews Dec. 3, 2017, 3:31 p.m. UTC | #2
On Sat, Dec 2, 2017 at 11:01 AM, Michael Niedermayer
<michael@niedermayer.cc> wrote:
> On Fri, Dec 01, 2017 at 04:09:15PM -0500, Tristan Matthews wrote:
>> Fix suggested by Luca Barbato.
>>
>> This was causing spurious EOFs when using -rtsp_transport udp, as
>> reported in https://bugzilla.libav.org/show_bug.cgi?id=1103
>> ---
>>  libavformat/rtsp.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> where is the code which interprets 0 as EOF ?

udp_read_packet is called here:
http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavformat/rtsp.c;h=b6da61b95e6c0ecce63d1d86e2b8fe7066ee2f96;hb=HEAD#l2082

which in turn, calls rtsp_parse_message here:
http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavformat/rtsp.c;h=b6da61b95e6c0ecce63d1d86e2b8fe7066ee2f96;hb=HEAD#l2010

which returns 0 in the non-error case here:
http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavformat/rtsp.c;h=b6da61b95e6c0ecce63d1d86e2b8fe7066ee2f96;hb=HEAD#l1945

this is then interpreted as an EOF here
http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavformat/rtsp.c;h=b6da61b95e6c0ecce63d1d86e2b8fe7066ee2f96;hb=HEAD#l2098

Best,
Tristan

> also nicolas may want to look at this, he was working on EOF vs 0 issues
> (thus ccing nicolas)
>
> thanks
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> it is not once nor twice but times without number that the same ideas make
> their appearance in the world. -- Aristotle
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
diff mbox

Patch

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index b6da61b95e..cf7cdb2f2b 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -2009,7 +2009,9 @@  static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
             }
 #if CONFIG_RTSP_DEMUXER
             if (rt->rtsp_hd && p[0].revents & POLLIN) {
-                return parse_rtsp_message(s);
+                if ((ret = parse_rtsp_message(s)) < 0) {
+                    return ret;
+                }
             }
 #endif
         } else if (n == 0 && ++timeout_cnt >= MAX_TIMEOUTS) {