Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
[AMLCodec] dont poll decoder rate when seeking #15835
The following commit (submitted by me) has introduced a regression whereby playback can freeze following seek operations: #15667
This commit builds on the previous one, to ensure the decoder fps rate is only queried when in normal playback mode.
Motivation and Context
Following #15667 playback may freeze following seek operations when using AML H/W acceleration.
I added extra debugging here to show the values of vs.fps following a series of SkipForward actions:
During seek/skip operations the decoder rate is being queried in the middle of CAMLCodec::Reset. This yields unpredictable results, since the fps value being returned from the AML API appears to be undefined (depends what is on the stack at the time).
If the value happens to be positive then this can lead to undesirable results, as shown here where the video completely froze following a seek; notice the rate was adjusted to 41 (vs.fps would have been approx 2341):
The issue occurs entirely at random, as it all depends what is on the memory stack at the time, but is easy to reproduce (just perform a few SkipFoward actions).
I think this was introduced when we made a final change to #15667, just prior to merge, to use C++ style casts. I had previously tested for over a week with no issues; however, I started to notice this issue pretty soon after the final version was merged.
This patch fixes things by skipping the decoder rate check and video_rate (re)-calculation if either:
Thus avoiding us trying to read an undefined fps rate variable from the AML API (which leads to "undefined" behaviour).
It also ensures the fps rate is >0 before running the calculation, so there's no chance we ever attempt to divide by zero.
How Has This Been Tested?
With a sample 60 minute video...
Without this fix, playback freezes after performing a few SkipForward actions.
With this fix in place, I skipped through the same entire file, from start to finish in 10 second SkipFoward increments (>300 skips) without any playback freezes whatsoever. I repeated this same test with samples using other various frame rates; again without any problems.
Screenshots (if appropriate):
Types of change