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

DecodeFrameNoDelay yields frames one call later in 2.5.0 than in 2.4.1 #3837

Open
torokati44 opened this issue Jan 28, 2025 · 4 comments
Open

Comments

@torokati44
Copy link

torokati44 commented Jan 28, 2025

With the same (attached) example program, which has some test frame data hardcoded in it, I get different results with OpenH264 2.4.1 and 2.5.0:

Output of LD_PRELOAD=./libopenh264-2.4.1-linux64.7.so ./test: Version 2.4.1

Decoding nalu 0 succeeded
W/H: 0 0
No output frame

Decoding nalu 1 succeeded
W/H: 0 0
No output frame

Decoding nalu 2 succeeded
W/H: 256 160
No output frame

Decoding nalu 3 succeeded
W/H: 256 160
Output frame:
16 16 16 16 16 16 16 16

Decoding nalu 4 succeeded
W/H: 256 160
No output frame

Decoding nalu 5 succeeded
W/H: 256 160
Output frame:
235 16 16 16 16 16 16 16

Decoding nalu 6 succeeded
W/H: 256 160
Output frame:
235 235 16 16 16 16 16 16

Decoding nalu 7 succeeded
W/H: 256 160
Output frame:
235 235 235 16 16 16 16 16

Decoding nalu 8 succeeded
W/H: 256 160
Output frame:
235 235 235 235 16 16 16 16

Output of LD_PRELOAD=./libopenh264-2.5.0-linux64.7.so ./test: Version 2.5.0

Decoding nalu 0 succeeded
W/H: 0 0
No output frame

Decoding nalu 1 succeeded
W/H: 0 0
No output frame

Decoding nalu 2 succeeded
W/H: 256 160
No output frame

Decoding nalu 3 succeeded
W/H: 256 160
Output frame:
16 16 16 16 16 16 16 16

Decoding nalu 4 succeeded
W/H: 256 160
No output frame

Decoding nalu 5 succeeded
W/H: 256 160
No output frame

Decoding nalu 6 succeeded
W/H: 256 160
Output frame:
235 16 16 16 16 16 16 16

Decoding nalu 7 succeeded
W/H: 256 160
Output frame:
235 235 16 16 16 16 16 16

Decoding nalu 8 succeeded
W/H: 256 160
Output frame:
235 235 235 16 16 16 16 16

The included test data looks like this: https://github.com/user-attachments/assets/76d1ba59-27c2-404b-9a19-6cec64ad216b

hsv.mp4

NALUs 0 and 1 are the SPS and PPS, respectively.

The eight logged numbers for every output frame are the luminosities of each of the 32x32 pixel squares at the top (235 for white, 16 for black).
Notice how in 2.4.1, the 3rd NALU yields the first frame, then the 4th one doesn't (understandably, it has to be reordered), but then decoding NALUs 5th and 6th again result in frames, in the correct order.
In 2.5.0, decoding neither the 4th or 5th NALUs return a frame, and from the 6th one on, they all start coming in again, but with one more call of latency.

This was probably caused by #3752, and blocks ruffle-rs/ruffle#18581.

I honestly don't understand how the "decoding latency on Qualcomm hardware decoders" (as noted in the linked suspect PR) has anything to do with this.

The example program: main.zip

@BenzhengZhang
Copy link
Collaborator

@fippo Could you check this suspected regression?

@fippo
Copy link
Contributor

fippo commented Feb 12, 2025

That #3752 was a encoder change and the SPS shows pic_order_cnt_type=0 so this should not be related?

#3787 might be it, should be easy to check by reverting it and running the test program.

@torokati44
Copy link
Author

That #3752 was a encoder change and the SPS shows pic_order_cnt_type=0 so this should not be related?

That was just a guess on my part, it's entirely possible that it was wrong.

@fippo
Copy link
Contributor

fippo commented Feb 12, 2025

I did a bisect with the test provided (great, that should be a unit test!) and that points to #3734

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants