Skip to content

Queue frames till Video Frame Observer is ready#1689

Open
ganeshprasads wants to merge 1 commit into
WebPlatformForEmbedded:wpe-2.38from
ganeshprasads:wpe-2.38-webrtc-blackscreen
Open

Queue frames till Video Frame Observer is ready#1689
ganeshprasads wants to merge 1 commit into
WebPlatformForEmbedded:wpe-2.38from
ganeshprasads:wpe-2.38-webrtc-blackscreen

Conversation

@ganeshprasads

@ganeshprasads ganeshprasads commented Jun 15, 2026

Copy link
Copy Markdown

https://bugs.webkit.org/show_bug.cgi?id=317111
Reviewed by: E. Ocaña González

Problem : WebRTC playback doesnot recover from a black screen and the issue is seen Intermittently

Cause: The first video frame(s) (containing SPS/PPS/IDR) being dropped
because libwebrtc starts delivering decoded frames before the downstream
GStreamer pipeline's InternalSource registers as a VideoFrameObserver.

Without first having the SPS/PPS and the first sync frame , the decoder
can not decode any subsequent delta frames.

In Following code snippet from mediastream/gstreamer/GStreamerMediaStreamSource.cpp,
frames received while m_isObserving is false might be dropped.

void videoFrameAvailable(VideoFrame& videoFrame, VideoFrameTimeMetadata) final {
return;

updateFirstVideoSampleSeenFlag();

Change : While this patch doesnot address the root cause of delayed start of
VideoFrameObserver, add a small frame buffer to hold frames
(currently max size set to 30 frames) that arrive before any observer registers.
deliver the frames when observer is registered
Note: From tests it is observed that only the first frame or 2 is actually needed to be queued.

  • Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp: (RealtimeMediaSource::videoFrameAvailable) : Queue frames till observer is ready
  • Source/WebCore/platform/mediastream/RealtimeMediaSource.h: (struct PendingVideoFrame): Added a buffer to hold the frames
    737e7dc
Build-Tests Layout-Tests
✅ 🛠 wpe-238-amd64-build ❌ 🧪 wpe-238-amd64-layout
✅ 🛠 wpe-238-arm32-build ❌ 🧪 wpe-238-arm32-layout

https://bugs.webkit.org/show_bug.cgi?id=317111
Reviewed by: E. Ocaña González

Problem : WebRTC playback doesnot recover from a black screen and the issue is seen Intermittently

 Cause: The first video frame(s) (containing SPS/PPS/IDR) being dropped
 because libwebrtc starts delivering decoded frames before the downstream
 GStreamer pipeline's InternalSource registers as a VideoFrameObserver.

 Without first having the SPS/PPS and the first sync frame , the decoder
 can not decode any subsequent delta frames.

 In Following code snippet from mediastream/gstreamer/GStreamerMediaStreamSource.cpp,
 frames received while m_isObserving is false might be dropped.

void videoFrameAvailable(VideoFrame& videoFrame, VideoFrameTimeMetadata) final
{
       return;

    updateFirstVideoSampleSeenFlag();

Change : While this patch doesnot address the root cause of delayed start of
 VideoFrameObserver, add a small frame buffer to hold frames
 (currently max size set to 30 frames) that arrive before any observer registers.
 deliver the frames when observer is registered
Note: From tests it is observed that only the first frame or 2 is actually needed to be queued.

* Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp:
  (RealtimeMediaSource::videoFrameAvailable) : Queue frames till
observer is ready
* Source/WebCore/platform/mediastream/RealtimeMediaSource.h:
  (struct PendingVideoFrame) : Added a buffer to hold the frames
@modeveci modeveci requested a review from eocanha June 15, 2026 09:52
@eocanha eocanha self-assigned this Jun 17, 2026
@eocanha eocanha added the upstream Related to an upstream bug (or should be at some point) label Jun 17, 2026
@eocanha

eocanha commented Jun 18, 2026

Copy link
Copy Markdown
Member

Ported this PR upstream, with some modifications to avoid 4 layour test regressions, and submitted it as WebKit/WebKit#67460 for review there (on the https://bugs.webkit.org/show_bug.cgi?id=317111 upstream bug created by Ganesh).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

upstream Related to an upstream bug (or should be at some point) wpe-2.38

Development

Successfully merging this pull request may close these issues.

3 participants