I am using Janus v 0.0.8 compiled a few days ago and also tried with different mtu lengths, e.g:
raspivid --verbose --nopreview --width 640 --height 480 --framerate 15 \
--qp 20 --intra 40 --profile baseline --timeout 0 -o - | gst-launch-1.0 -v fdsrc \
! h264parse ! rtph264pay config-interval=10 pt=96 mtu=1300 ! udpsink host=192.168.178.22 port=8004
but I see no significant difference. The latency is very small, ~200-300 ms.
To recap:
I see "video freezes" when sending a H.264/RTP stream from Raspberry Pi and using the Janus
streaming demo to view to video towards Mozilla/Firefox 35.0.1 (Linux).
Initially, I thought I had packetloss in my local Wi-Fi network, but this is not the case.
However, its RTT is varying quite a lot:
9714 packets transmitted, 9704 received, 0% packet loss, time 98265ms
rtt min/avg/max/mdev = 3.362/5.779/157.771/5.655 ms, pipe 9
...and a shorter sample...:
538 packets transmitted, 538 received, 0% packet loss, time 5372ms
rtt min/avg/max/mdev = 3.742/4.971/11.558/1.206 ms
The WebRTC log from Firefox says:
RTP statistics
inbound_rtp_video_1
Decoder: Avg. bitrate: 0.00 Mbps (0.00 SD) Avg. framerate: 0.00 fps (0.00 SD) Discarded packets: 0
Local: 22:07:29 GMT+0100 (CET) inboundrtp SSRC: 704087196 Received: 29806 packets (35501.08 Kb) Lost: 43 Jitter: 0
(why is birate=0?) SSRC reports 43 lost and 0 jitter.
Now I wanted to know if VP8/RTP from Gstreamer is behaving in a similar manner so I used the following pipe:
gst-launch-1.0 -v v4l2src ! 'video/x-raw, format=(string)I420, width=(int)320,\
height=(int)240, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive,
framerate=(fraction)30/1' ! vp8enc keyframe-max-dist=60 ! rtpvp8pay pt=100 mtu=1300 \
! udpsink host=192.168.178.22 port=9004
to generate a VP8 stream from a PC (VP8 is not supported by Raspberry Pi).
and the WebRTC log from Firefox says:
RTP statistics
inbound_rtp_video_1
Decoder: Avg. bitrate: 0.00 Mbps (0.00 SD) Avg. framerate: 0.00 fps (0.00 SD) Discarded packets: 0
Local: 22:33:13 GMT+0100 (CET) inboundrtp SSRC: 1625784456 Received: 8902 packets (9885.51 Kb) Lost: 17 Jitter: 4.591
(Again, bitrate=0?)
Also here I have some loss which is also visible but the difference is that for VP8 jitter is reported, for H.264 not.
There is also almost no 'freezes' and latency is larger - ~800-1000 ms.
I wanted to try a Gstreamer/H.264/RTP from a PC too but failed and instead only got
"Still waiting for the DTLS stack for component 1 in stream 1..." - no idea what is missing since my VP8 pipeline worked.
So final test is to do a VP8 video call via Janus using Firefox and Chrome to check if use of their own VP8 enc/dec/WebRTC makes a
difference. And it does: although latency is very low, there are no freezes until this happens in Janus:
[ERR] [ice.c:janus_ice_send_thread:2238:] [2537241960] ... only sent -1 bytes? (was 1074) [ERR] [ice.c:janus_ice_cb_nice_recv:1023:] [2537241960] SRTP unprotect error: err_status_replay_old (len=1000-->1000, ts=4253741017, seq=48076)
Now to my own speculations:
considering the very low video latency I see (~200-300 ms), packet/frame arrival to the browser can be critical if Firefox reception buffer
is too small - hence causing frames to be discarded since they arrive too 'late' - thus some sort of underrun.
This can perhaps be regarded as confirmed since when connecting Raspberry Pi directly via LAN cable to Janus PC and viewing
the stream also on the Janus PC, I had much less 'freezes', also with the same low latency.
It shall also be mentioned that viewing the RTP stream directly with Gstreamer on any PC in the Wi-Fi network
does not cause any freezes at all.
When doing a video call using the browsers 'internals' the freezes are reduced to a minimum, still maintaining low latency (but using high bandwidth) and the browser manages to report a bandwidth which was not the case previously.
Is there some sort of bandwidth negotiation going wrong or missing in the initial case, e.g. due to bad Gstreamer pipeline?
Is WebRTC/Janus not handling the bandwidth/timing correctly when receiving a RTP stream?
Why do I get a jitter buffer for Gstreamer generated VP8 but not for h.264 - some setting in Firefox missing?
(I would like to setup a H.264 stream direct to Mozilla/Firefox to check but do not know how)
I would appreciate feedback to understand if I have something wrong in my setup or Gstreamer pipeline or if we really have an Raspberry, Janus or Firefox issue.
Can someone here confirm a 'working' H.264/RTP stream? If so, how does it look like?