#5824 closed defect (worksforme)
FFmpeg 3.1.3 av_read_frame returning -104 ECONNRESET
| Reported by: | Hapie | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | avformat |
| Version: | git-master | Keywords: | |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
Hey,
I am streaming mp3 audio from url using ffmpeg 3.1.3 which is able to play audio nicely for 5 seconds and then it hangs.
On debugging in logs I found av_read_frame returning -104 value which is I guess ECONNRESET error.
Any idea why connection is getting reset?
Plus on some other streams if a pause player for more than 120 seconds which is default reconnect delay time limit, it return -104 again.
[I increased reconnect delay limit by using avoptions -reconnect_at_eof 1, -reconnect_delay 3600, and -reconnect 1]
Attachments (1)
Change History (10)
comment:1 by , 10 years ago
| Keywords: | ECONNRESET -104 removed |
|---|
comment:2 by , 10 years ago
Hi
Yes I have current git head 3.1.3 only. You can reproduce by streaming from this link http://anhadgurbani(dot)com:8888/fatehtv.mp3 and reading frames by av_read_frame. This particular stream stops after 5 seconds with -104 ECONNRESET error.
Thanks
comment:3 by , 10 years ago
| Resolution: | → worksforme |
|---|---|
| Status: | new → closed |
$ time ffplay -i http://anhadgurbani.com:8888/fatehtv.mp3
ffplay version N-81555-g496d97f Copyright (c) 2003-2016 the FFmpeg developers
built with gcc 4.7 (SUSE Linux)
configuration: --enable-gpl --enable-gnutls
libavutil 55. 29.100 / 55. 29.100
libavcodec 57. 54.102 / 57. 54.102
libavformat 57. 48.102 / 57. 48.102
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 60.100 / 6. 60.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mp3, from 'http://anhadgurbani.com:8888/fatehtv.mp3':
Metadata:
encoder : Lavf57.31.100
Duration: N/A, start: 0.000000, bitrate: 64 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, mono, s16p, 64 kb/s
60.36 M-A: 0.000 fd= 0 aq= 11KB vq= 0KB sq= 0B f=0/0
real 2m2.452s
user 0m1.622s
sys 0m0.923s
comment:4 by , 10 years ago
It doesn't work on Android. Could this be due to old NDK version?
With which NDK version I should compile latest FFmpeg head? Currently I am using NDK 9.
Thanks
comment:6 by , 10 years ago
Thanks for quick reply. I will test with current NDK and revert back. :)
comment:7 by , 10 years ago
FFmpeg switch over to http and tcp protocols while streaming. I figured out that tcp_read function in tcp.c of avformat containing recv function is returning -1 with errno is 104 which is ECONNRESET.
I wrote simple c code to build a socket and connected to the stream and it works well. But on device recv function return non-zero values for sometime and then suddenly returns -1.
Any idea what's going on with socket connections. Is it the server closing the connection or client Android app with ffmpeg code closing the connection?
Strange thing is it works fine for other audio streams but disconnects if I pause av_read_pause for more than 2 minutes (which is default timeout 120 seconds).
comment:8 by , 10 years ago
I have attached the sample c code which is replicating the 104 behaviour. What is found out is if we call shutdown(socket, 2) without close(socket) function afterwards then recv throws 104.
Maybe these points will help. Tested code on Linux machine.
comment:9 by , 10 years ago
After a week long debugging finally I figured out the bug by digging into FFMPEG code base. Thanks for no help.....



Please test current FFmpeg git head.
How can I reproduce the issue?