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

[Problem/Bug]: Delay in rendering frames using VideoDecoder with optimizeForLatency set to true #4099

Closed
cuijixiong1 opened this issue Oct 25, 2023 · 10 comments
Assignees
Labels
bug Something isn't working tracked We are tracking this work internally.

Comments

@cuijixiong1
Copy link

cuijixiong1 commented Oct 25, 2023

What happened?

I am encountering a bug when using the VideoDecoder API to decode and render video frames on a canvas element. Despite setting the optimizeForLatency flag to true in the decoder configuration, I am experiencing a delay in rendering. Specifically, frames are not rendered on the canvas until the decoder.flush() method is called, or until 10 P-frames have been processed. This results in a latency of rendering 10 frames, which is undesired. I do not encounter this issue when using other decoders like FFmpeg.

Importance

Blocking. My app's basic functions are not working due to this issue.

Runtime Channel

Stable release (WebView2 Runtime), Prerelease (Edge Canary/Dev/Beta)

Runtime Version

No response

SDK Version

No response

Framework

ALL and edge browser

Operating System

Windows 10, Windows 11

OS Version

No response

Repro steps

Steps to Reproduce:

Create a div and canvas element, and append the canvas to the div, and the div to the document body.
Create a new instance of VideoDecoder and configure it with the codec set to 'avc1.64001E' and optimizeForLatency set to true.
Create a Uint8Array and populate it with some video data.
Call the decoder.decode() method with a new EncodedVideoChunk object, passing the Uint8Array as the data property.
After a delay of 10 seconds, call the decoder.flush() method.

Expected Result:
Frames should be rendered on the canvas as they are decoded, without having to wait for 10 P-frames or a call to decoder.flush().

Actual Result:
Frames are not rendered on the canvas until decoder.flush() is called or 10 P-frames have been processed, resulting in a delay in
test.zip

Regression

No, this never worked

Last working version (if regression)

No response

AB#47369056

@cuijixiong1 cuijixiong1 added the bug Something isn't working label Oct 25, 2023
@cuijixiong1
Copy link
Author

cuijixiong1 commented Oct 25, 2023

test.zip
this test code

@victorhuangwq
Copy link
Collaborator

Just to clarify, by the Unity Plugin you are referring to the Hololens Unity plugin right?

@cuijixiong1
Copy link
Author

Just to clarify, by the Unity Plugin you are referring to the Hololens Unity plugin right?

I repeated the problem on all ends, including the edge browser

@victorhuangwq
Copy link
Collaborator

@srwei could you take a look at this bug?

@cuijixiong1
Copy link
Author

@srwei @victorhuangwq Any progress?

@victorhuangwq
Copy link
Collaborator

Hi @cuijixiong1 sorry for the delay - this seems like a browser problem, as you have also replicated it on the Edge Browser. I will track it internally in our backlog and route it accordingly, but at the same time I recommend that you use the send feedback function to report it as well.

image

@victorhuangwq victorhuangwq added the tracked We are tracking this work internally. label Nov 1, 2023
@cuijixiong1
Copy link
Author

@victorhuangwq Is there any progress on this issue now? I tried to submit feedback in the browser, but did not receive any results. I have provided a way to reproduce it. If you need my cooperation, please feel free to contact me at any time

@victorhuangwq
Copy link
Collaborator

victorhuangwq commented Jan 18, 2024

@cuijixiong1 This is an issue also replicated in Chromium, so it's not just an Edge browser / WebView2 issue. We aren't sure if it's a bug, or by design but we are following up on it.

@cuijixiong1
Copy link
Author

@victorhuangwq Is there any progress?

@victorhuangwq
Copy link
Collaborator

As mentioned, this is an upstream chromium behavior. I just checked - and it seems like you have already opened a similar request on the chromium repo here, and they have stated it's a won't fix.

https://issues.chromium.org/issues/40937776

Here's their reply:

This bitstream does not specify a bitstream_restriction, and as such will uses the maximum DPB size as its reorder window. The maximum DPB size is 15 given the profile, level, and resolution. I would expect your first output to happen after enqueueing 16 chunks, regardless of the decoder implementation being used.

Closing this issue

@victorhuangwq victorhuangwq closed this as not planned Won't fix, can't repro, duplicate, stale May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tracked We are tracking this work internally.
Projects
None yet
Development

No branches or pull requests

3 participants