pion / example-webrtc-applications

Examples of WebRTC applications that are large, or use 3rd party libraries

Home Page:https://pion.ly/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with the H.264 play from disk example

RaniRaven opened this issue · comments

This example is supposed to play H.264 file from disk.
The problem is the following 2 lines :
[1] h264FrameDuration = time.Millisecond * 33
[2] videoTrack.WriteSample(media.Sample{Data: nal.Data, Duration: time.Second})

On one hand the code assumes that the H.264 file is created with frames of length 33 msec (duration), on the other hand it writes the sample with a Second duration. Which means that the RTP stream created as a result is actually 30 times shorter than expected.

There is an issue with that, isn't there ?
Ain't the Duration values when writing sample supposed to be h264FrameDuration ?

Hi @RaniRaven

I pushed a change that uses the constant. Chromium seems to use the arrival time (and not the time on the RTP Packets) so you will see no behavior change. But easier for the reader!