Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue] Unexpected behavior with unstable connection #43

Closed
gouravd opened this issue Sep 17, 2015 · 6 comments
Closed

[Issue] Unexpected behavior with unstable connection #43

gouravd opened this issue Sep 17, 2015 · 6 comments

Comments

@gouravd
Copy link

gouravd commented Sep 17, 2015

I distributed a version of our app using PILI to few of our customers. We observe the following

!) One of our customer has a very unstable connection.
2) We use Nginx RTMP and see that the upload speed goes to 0 and when internet restores it goes back again to 364kbps or higher.
3) But when it goes to 0, on the RTMP server, PUBLISH_DONE is called, which basically means the stream is over.
4) But on the client side, no state callback is invoked (like STATE.DISCONNECTED, STATE.SHUTDOWN etc..)and the streaming continues, though no data is sent to the server

If I do a test and I disconnect the internet, STATE.DISCONNECTED is called and the behaviour is expected. But in extremely low and unstable connection speed, it looks like PILI is trying to stop and restart the streaming without calling any of the STATE callbacks. And when the streaming restarts in the same session, the Upload speed is always 0 and no data is actually sent to the server.

in the NGINX RTMP and FFMPEG logs in our backend server, we can see that the streaming is getting started then getting over and then getting started and the cycle continues. But in the client side SHUTDOWN or any other error state is not called.

Unfortunately I would not be able to get the logs from customer's mobile.

@gouravd
Copy link
Author

gouravd commented Sep 17, 2015

Here's a sample part of the FFMPEG log which shows how FFMPEG is called again and again. in normal scenarios, it is called only once.

ffmpeg version N-73031-gd4c9ece Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu114.04)
configuration: --prefix=/home/XXXXXXXXXX/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/XXXXXXXXXX/ffmpeg_build/include --extra-ldflags=-L/home/XXXXXXXXXX/ffmpeg_build/lib --bindir=/home/XXXXXXXXXX/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 42.100 / 56. 42.100
libavformat 56. 37.100 / 56. 37.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 17.100 / 5. 17.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
[flv @ 0x29a5420] Stream discovered after head already parsed
Input #0, flv, from 'rtmp://XXXXXXXXXXXXXXXXXXXX/live/UCNdYjXq5C_SlwO2Axiic_20150917_213905':
Metadata:
Server : NGINX RTMP (github.com/arut/nginx-rtmp-module)
displayWidth : 432
displayHeight : 768
fps : 15
profile :
level :
Duration: 00:00:00.00, start: 0.009000, bitrate: N/A
Stream #0:0: Video: h264 (Baseline), yuv420p, 432x768, 358 kb/s, 15 tbr, 1k tbn, 2k tbc
Stream #0:1: Audio: aac (LC), 44100 Hz, mono, fltp
[libx264 @ 0x2b04380] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x2b04380] profile Constrained Baseline, level 3.0
[libx264 @ 0x2b04380] 264 - core 142 r2389 956c8d8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=0 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=512 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/home/XXXXXXXXXX/Videos/mp4/UCNdYjXq5C_SlwO2Axiic_20150917_213905.mp4':
Metadata:
Server : NGINX RTMP (github.com/arut/nginx-rtmp-module)
displayWidth : 432
displayHeight : 768
fps : 15
profile :
level :
encoder : Lavf56.37.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 432x768, q=-1--1, 512 kb/s, 30 fps, 15360 tbn, 30 tbc
Metadata:
encoder : Lavc56.42.100 libx264
Stream #0:1: Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 44100 Hz, mono, s16, 96 kb/s
Metadata:
encoder : Lavc56.42.100 libfdk_aac
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
frame= 105 fps=0.0 q=13.0 size= 93kB time=00:00:04.03 bitrate= 189.5kbits/s dup=67 drop=0
frame= 107 fps= 55 q=13.0 size= 99kB time=00:00:04.10 bitrate= 198.7kbits/s dup=68 drop=0
frame= 109 fps= 43 q=13.0 size= 105kB time=00:00:04.17 bitrate= 206.2kbits/s dup=69 drop=0
frame= 111 fps= 21 q=13.0 size= 111kB time=00:00:04.23 bitrate= 214.1kbits/s dup=70 drop=0
frame= 127 fps= 21 q=14.0 size= 157kB time=00:00:04.77 bitrate= 268.7kbits/s dup=78 drop=0
frame= 133 fps= 19 q=14.0 size= 170kB time=00:00:04.95 bitrate= 281.5kbits/s dup=81 drop=0
frame= 165 fps= 21 q=13.0 size= 248kB time=00:00:06.02 bitrate= 337.4kbits/s dup=97 drop=0
frame= 175 fps= 20 q=13.0 size= 270kB time=00:00:06.35 bitrate= 348.1kbits/s dup=102 drop=0
frame= 181 fps= 20 q=13.0 size= 284kB time=00:00:06.56 bitrate= 354.0kbits/s dup=105 drop=0
ffmpeg version N-73031-gd4c9ece Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1
14.04)
configuration: --prefix=/home/XXXXXXXXXX/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/XXXXXXXXXX/ffmpeg_build/include --extra-ldflags=-L/home/XXXXXXXXXX/ffmpeg_build/lib --bindir=/home/XXXXXXXXXX/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 42.100 / 56. 42.100
libavformat 56. 37.100 / 56. 37.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 17.100 / 5. 17.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
ffmpeg version N-73031-gd4c9ece Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu114.04)
configuration: --prefix=/home/XXXXXXXXXX/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/XXXXXXXXXX/ffmpeg_build/include --extra-ldflags=-L/home/XXXXXXXXXX/ffmpeg_build/lib --bindir=/home/XXXXXXXXXX/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 42.100 / 56. 42.100
libavformat 56. 37.100 / 56. 37.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 17.100 / 5. 17.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
ffmpeg version N-73031-gd4c9ece Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1
14.04)
configuration: --prefix=/home/XXXXXXXXXX/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/XXXXXXXXXX/ffmpeg_build/include --extra-ldflags=-L/home/XXXXXXXXXX/ffmpeg_build/lib --bindir=/home/XXXXXXXXXX/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 42.100 / 56. 42.100
libavformat 56. 37.100 / 56. 37.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 17.100 / 5. 17.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
rtmp://XXXXXXXXXXXXXXXXXXXX/live/UCNdYjXq5C_SlwO2Axiic_20150917_213905: Input/output error
rtmp://XXXXXXXXXXXXXXXXXXXX/live/UCNdYjXq5C_SlwO2Axiic_20150917_213905: Input/output error
rtmp://XXXXXXXXXXXXXXXXXXXX/live/UCNdYjXq5C_SlwO2Axiic_20150917_213905: Input/output error
[mp4 @ 0x2b028c0] Starting second pass: moving the moov atom to the beginning of the file
frame= 187 fps=1.0 q=-1.0 Lsize= 460kB time=00:00:12.50 bitrate= 301.2kbits/s dup=108 drop=0
video:344kB audio:109kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.543049%
[libx264 @ 0x2b04380] frame I:2 Avg QP:10.52 size: 6195
[libx264 @ 0x2b04380] frame P:185 Avg QP: 5.31 size: 1835
[libx264 @ 0x2b04380] mb I I16..4: 91.2% 0.0% 8.8%
[libx264 @ 0x2b04380] mb P I16..4: 1.4% 0.0% 0.1% P16..4: 9.4% 1.0% 0.5% 0.0% 0.0% skip:87.5%
[libx264 @ 0x2b04380] final ratefactor: 7.63
[libx264 @ 0x2b04380] coded y,uvDC,uvAC intra: 30.5% 4.3% 2.6% inter: 4.0% 0.9% 0.5%
[libx264 @ 0x2b04380] i16 v,h,dc,p: 74% 17% 7% 2%
[libx264 @ 0x2b04380] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 21% 29% 4% 5% 2% 4% 2% 3%
[libx264 @ 0x2b04380] i8c dc,h,v,p: 94% 1% 4% 1%
[libx264 @ 0x2b04380] ref P L0: 94.9% 2.7% 2.4%
[libx264 @ 0x2b04380] kb/s:451.61
Received signal 15: terminating.
ffmpeg version N-73031-gd4c9ece Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu114.04)
configuration: --prefix=/home/XXXXXXXXXX/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/XXXXXXXXXX/ffmpeg_build/include --extra-ldflags=-L/home/XXXXXXXXXX/ffmpeg_build/lib --bindir=/home/XXXXXXXXXX/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 42.100 / 56. 42.100
libavformat 56. 37.100 / 56. 37.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 17.100 / 5. 17.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
ffmpeg version N-73031-gd4c9ece Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1
14.04)
configuration: --prefix=/home/XXXXXXXXXX/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/XXXXXXXXXX/ffmpeg_build/include --extra-ldflags=-L/home/XXXXXXXXXX/ffmpeg_build/lib --bindir=/home/XXXXXXXXXX/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 42.100 / 56. 42.100
libavformat 56. 37.100 / 56. 37.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 17.100 / 5. 17.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
ffmpeg version N-73031-gd4c9ece Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu114.04)
configuration: --prefix=/home/XXXXXXXXXX/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/XXXXXXXXXX/ffmpeg_build/include --extra-ldflags=-L/home/XXXXXXXXXX/ffmpeg_build/lib --bindir=/home/XXXXXXXXXX/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 42.100 / 56. 42.100
libavformat 56. 37.100 / 56. 37.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 17.100 / 5. 17.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
[rtmp @ 0x3c5e820] Server error: No such stream
rtmp://XXXXXXXXXXXXXXXXXXXX/live/UCNdYjXq5C_SlwO2Axiic_20150917_213905: Operation not permitted
[rtmp @ 0x3b28820] Server error: No such stream
rtmp://XXXXXXXXXXXXXXXXXXXX/live/UCNdYjXq5C_SlwO2Axiic_20150917_213905: Operation not permitted
[rtmp @ 0x31fb820] Server error: No such stream
rtmp://XXXXXXXXXXXXXXXXXXXX/live/UCNdYjXq5C_SlwO2Axiic_20150917_213905: Operation not permitted
ffmpeg version N-73031-gd4c9ece Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1
14.04)
configuration: --prefix=/home/XXXXXXXXXX/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/XXXXXXXXXX/ffmpeg_build/include --extra-ldflags=-L/home/XXXXXXXXXX/ffmpeg_build/lib --bindir=/home/XXXXXXXXXX/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 42.100 / 56. 42.100
libavformat 56. 37.100 / 56. 37.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 17.100 / 5. 17.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
ffmpeg version N-73031-gd4c9ece Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu114.04)
configuration: --prefix=/home/XXXXXXXXXX/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/XXXXXXXXXX/ffmpeg_build/include --extra-ldflags=-L/home/XXXXXXXXXX/ffmpeg_build/lib --bindir=/home/XXXXXXXXXX/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 42.100 / 56. 42.100
libavformat 56. 37.100 / 56. 37.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 17.100 / 5. 17.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
ffmpeg version N-73031-gd4c9ece Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1
14.04)
configuration: --prefix=/home/XXXXXXXXXX/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/XXXXXXXXXX/ffmpeg_build/include --extra-ldflags=-L/home/XXXXXXXXXX/ffmpeg_build/lib --bindir=/home/XXXXXXXXXX/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 42.100 / 56. 42.100
libavformat 56. 37.100 / 56. 37.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 17.100 / 5. 17.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
[rtmp @ 0x3e03820] Server error: No such stream
rtmp://XXXXXXXXXXXXXXXXXXXX/live/UCNdYjXq5C_SlwO2Axiic_20150917_213905: Operation not permitted
[rtmp @ 0x3d63820] Server error: No such stream
rtmp://XXXXXXXXXXXXXXXXXXXX/live/UCNdYjXq5C_SlwO2Axiic_20150917_213905: Operation not permitted
[rtmp @ 0x2307820] Server error: No such stream
rtmp://XXXXXXXXXXXXXXXXXXXX/live/UCNdYjXq5C_SlwO2Axiic_20150917_213905: Operation not permitted
ffmpeg version N-73031-gd4c9ece Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
configuration: --prefix=/home/XXXXXXXXXX/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/XXXXXXXXXX/ffmpeg_build/include --extra-ldflags=-L/home/XXXXXXXXXX/ffmpeg_build/lib --bindir=/home/XXXXXXXXXX/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 42.100 / 56. 42.100
libavformat 56. 37.100 / 56. 37.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 17.100 / 5. 17.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100

@jpxiong
Copy link
Contributor

jpxiong commented Sep 18, 2015

In fact, if the network is timeout, CONNECTION_TIMEOUT will be called. If not, that means the connection is ok.

But in extremely low and unstable connection speed, it looks like PILI is trying to stop and restart the streaming without calling any of the STATE callbacks.

but the connection shouldn't be broken, that is to say, the stream should be existing.

@gouravd
Copy link
Author

gouravd commented Sep 18, 2015

I agree, but the only problem is that after it stops and restarts the streaming, the sending speed is always 0 and the frames are not sent to the server. I see this same behaviour when I switch camera in current version also. It stops and restarts streaming, but after restarting, it actually never sends the frames to the server. In the server we see incoming bytes as 0.

@jpxiong
Copy link
Contributor

jpxiong commented Sep 22, 2015

Please test it on v1.3.6.

@gouravd
Copy link
Author

gouravd commented Sep 22, 2015

Sure, will test and let you know.

On Tue, Sep 22, 2015 at 6:29 PM, jpxiong notifications@github.com wrote:

Please test it on v1.3.6.


Reply to this email directly or view it on GitHub
#43 (comment)
.

Regards,
Das, DET Labs

@gouravd
Copy link
Author

gouravd commented Sep 25, 2015

Closing this as looks like issue is solved. Will reopen with more tests reveal the problem

@gouravd gouravd closed this as completed Sep 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants