Opened 9 years ago
Last modified 3 years ago
#4929 open defect
RTSP protocol not sending TEARDOWN packet
Reported by: | Nicolas | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | ffplay |
Version: | git-master | Keywords: | rtsp |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
When a client close a rtsp connexion, it is supposed to send the TEARDOWN packet according to
https://en.wikipedia.org/wiki/Real_Time_Streaming_Protocol
ffmpeg doesn't (controlled by wireshark), while i guess it worked at a given time while the code to do it is inside ffmpeg.
In short, because my tv provider allows only 1 channel at a time, i've to wait 30 seconds between each channel change.
Below, you'll find more detail, and a not perfect but working patch to show the problem more in detail.
How to reproduce:
% ffplay 'rtsp://mafreebox.freebox.fr/fbxtv_pub/stream?namespace=1&service=201&flavour=ld' ffmpeg version : git version
The attached file is not really a patch while it's not the good way to fix.
However, it works in my case.
The thing is that
rtsp::read_close function
containing ff_rtsp_send_cmd_async(s, "TEARDOWN", rt->control_uri, NULL);
is called after
is->abort_request = 1;
SDL_WaitThread(is->read_tid, NULL);
and at the end, the packet is never sent.
To quickly and badly fix, i've added a preclose function called before the sdl_waitthread.
Attachments (1)
Change History (5)
by , 9 years ago
comment:1 by , 9 years ago
Component: | avcodec → avformat |
---|---|
Keywords: | rtsp added; TEARDOWN RTSP removed |
Priority: | important → normal |
Please send your patch to the development mailing list, patches are ignored on this bug tracker.
comment:2 by , 9 years ago
in the lowest network function, there is a test : "if (ff_check_interrupt(int_cb))" which make things not working
i can : or remove this check, but i think that it could be usefull for something else, or
add a parameter "force" to low network functions, but it touches the network.c of ffmpeg, so i guess you would not accept it easily
the thing is that testing if the user requesting to quit in this function it not valid with the fact that rtsp protocol require network packet sending at the disconnection.
Comment these 2 lines in libavformat/avio.c & libavformat/network.c fixes the problem :
if (ff_check_interrupt(&h->interrupt_callback))
return AVERROR_EXIT;
comment:3 by , 3 years ago
There is -rtpflags send_bye but that sends BYE which is just before TEARDOWN. It looks like TEARDOWN is not mandatery, at least in real implementations. also, is this just a bug in ffplay?? I mean ffplay is no supposed to be perfect...
In fact there is a patch that SAYS TO NOT SEND TEARDOWN is some specific case https://patchwork.ffmpeg.org/project/ffmpeg/patch/20190805071646.14780-1-phunkyfish@gmail.com/ that was chnaged to 460f74495fa93c4bb85503c5443580e2bb857efa.
Patch for this bug is on the mailing list if you are interested https://patchwork.ffmpeg.org/project/ffmpeg/patch/1488418932-26817-1-git-send-email-vincent860602@gmail.com/
comment:4 by , 3 years ago
Component: | avformat → ffplay |
---|---|
Status: | new → open |
Ffmpeg is not affected. See #9792.
ffplay preclose function for tearing down rtsp