Closed Bug 1774429 Opened 4 years ago Closed 3 years ago

WebRTC video fails to play

Categories

(Core :: WebRTC, defect, P2)

Firefox 101
defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: cfbraun, Unassigned)

References

Details

Attachments

(2 files)

Steps to reproduce:

Subscribe to a Janus VideoRoom

Actual results:

Video does not play. Attached log file shows that video frames are 'too long into the future'. The problem is confined to a single tab; opening another tab in the same browser to the same page and entering the same room works.

Expected results:

Video should play

The above explanation might be too short: on the testing machine I have two tabs showing the same web page. Entering the room on tab A never works, the log shows dropped frames being 'too long into the future' every time. Entering the same room in the 2nd tab works every time. So there might be some global state that is kept between different RtcPeerConnections?

The Bugbug bot thinks this bug should belong to the 'Core::WebRTC' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → WebRTC
Product: Firefox → Core

The severity field is not set for this bug.
:mjf, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(mfroman)

I added logging of new_frame.render_time_ms() and time_now to the 'Frame too long into the future' message with interesting results: in the attached log the first received video frame is logged with an arrival time of 161640042. The 'too long into the future' message logs a render_time_ms of 161640757 (which looks reasonable), but a time_now of 86401241. So there is a large difference between the clock used for the arrival time and the clock used by libwebrtc in video_render_frames.cc.

This might be connected to https://hg.mozilla.org/mozilla-central/rev/fdeabccf03769e3c3cb9ad687e2b600495b003ec. The date of the above changeset roughly matches the first occurrence of the problem for us (first reports coming in around New Year 2022).

Looks like the render timestamp is generated from RTCStatsTimestampMakerRealtimeClock::CurrentTime(), but VideoRenderFrames::AddFrame compares it against rtc::TimeMillis. These two clocks seem to use different offsets and can cause the 'future' comparison to fail.

Actually the comment in WebrtcSystemTimeBase() hints that the different offsets are what is wanted, but then the check in VideoRenderFrames::AddFrame either needs to use RTCStatsTimestampMakerRealtimeClock::CurrentTime() or should be disabled.

As rtc::TimeMillis is also used to delay rendering the next frame, the whole concept of using RTCStatsTimestampMakerRealtimeClock::CurrentTime() for the rendering timestamp seems suspicious.

The fact that this works in one tab but not the other hints that this problem is related to clock drift, perhaps in a very old tab, but it is hard to say for sure. Does this reliably work in new tabs? How long had this tab been open?

Flags: needinfo?(cfbraun)

Please see my further comments. The problem is caused by using different clock offsets for RTCStatsTimestampMakerRealtimeClock::CurrentTime() and WebrtcSystemTimeBase(). These offsets are initialized when the corresponding clock is used for the first time.

Flags: needinfo?(cfbraun)
Severity: -- → S2
Priority: -- → P2
Flags: needinfo?(mfroman)
Flags: needinfo?(dbaker)
Severity: S2 → S3

Does this still reproduce on the latest 106 build? If so do you have a Janus VideoRoom you can provide access to that reproduces this issue?

Flags: needinfo?(dbaker) → needinfo?(cfbraun)
See Also: → 1800942

A needinfo is requested from the reporter, however, the reporter is inactive on Bugzilla. Closing the bug as incomplete.

For more information, please visit auto_nag documentation.

Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Flags: needinfo?(cfbraun)
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: