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

Prevent error msg: 'Unrecoverable player error occurred' while playin… #6503

Merged
merged 1 commit into from
Jul 14, 2021

Conversation

evermind-zz
Copy link
Contributor

@evermind-zz evermind-zz commented Jun 17, 2021

…g video during rotation (#6502)

Playing a video in VideoDetailFragment and rotating the screen to landscape (back and forth more often)
can trigger this error message. Especially if rotation for whatever reason takes long or
playing a high resolution (1080p) video.

The underlying logcat error messages:
05-12 16:38:38.251 24920 26037 E Surface : getSlotFromBufferLocked: unknown buffer: 0x923fc810
05-12 16:38:38.251 24920 26037 W ACodec : [OMX.qcom.video.decoder.avc] can not return buffer 35 to native window

The problem is that that Exoplayer is trying to write to our -- during rotation -- no longer existant
(VideoDetailFragment) SurfaceView.

Solution:
Implementing SurfaceHolder.Callback and using DummySurface we can now handle the lifecycle of the Surface.

How?: In case we are no longer able to write to the Surface eg. through rotation/putting in
background we can set a DummySurface. Although it only works on API >= 23.
Result: we get a little video interruption (audio is still fine) but we won't get the
'Unrecoverable player error occurred' error message.

This implementation is based on and more background information:
'ExoPlayer stuck in buffering after re-adding the surface view a few time 2703'

-> exoplayer fix suggestion link
google/ExoPlayer#2703 (comment)

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

  • no error message 'Unrecoverable player error occurred' of video while rotation

Fixes the following issue(s)

APK testing

On the website the APK can be found by going to the "Checks" tab below the title and then on "artifacts" on the right.

Due diligence

@TobiGr TobiGr added bug Issue is related to a bug player Issues related to any player (main, popup and background) labels Jun 17, 2021
Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@evermind-zz evermind-zz force-pushed the fixes-for-upstream branch 2 times, most recently from 3e80d0e to 2a68475 Compare June 19, 2021 06:42
@evermind-zz evermind-zz requested a review from Stypox June 25, 2021 04:21
Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the comment the code looks good to me. Thank you :-)

Stypox
Stypox previously approved these changes Jul 5, 2021
Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested and it works well on both API 19 emulated and API 29 real.

…g video during rotation (TeamNewPipe#6502)

Playing a video in VideoDetailFragment and rotating the screen to landscape (back and forth more often)
can trigger this error message. Especially if rotation for whatever reason takes long or
playing a high resolution (1080p) video.

The underlying logcat error messages:
05-12 16:38:38.251 24920 26037 E Surface : getSlotFromBufferLocked: unknown buffer: 0x923fc810
05-12 16:38:38.251 24920 26037 W ACodec  : [OMX.qcom.video.decoder.avc] can not return buffer 35 to native window

The problem is that that Exoplayer is trying to write to our -- during rotation -- no longer existant
(VideoDetailFragment) SurfaceView.

Solution:
Implementing SurfaceHolder.Callback and using DummySurface we can now handle the lifecycle of the Surface.

How?: In case we are no longer able to write to the Surface eg. through rotation/putting in
background we can set a DummySurface. Although it only works on API >= 23.
Result: we get a little video interruption (audio is still fine) but we won't get the
'Unrecoverable player error occurred' error message.

This implementation is based on and more background information:
 'ExoPlayer stuck in buffering after re-adding the surface view a few time 2703'

 -> exoplayer fix suggestion link
  google/ExoPlayer#2703 (comment)
@evermind-zz
Copy link
Contributor Author

I've merged the changes and updated pull request

@evermind-zz evermind-zz requested a review from Stypox July 6, 2021 10:55
@TobiGr TobiGr merged commit dfa941a into TeamNewPipe:dev Jul 14, 2021
@evermind-zz evermind-zz deleted the fixes-for-upstream branch July 26, 2021 11:33
This was referenced Aug 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug player Issues related to any player (main, popup and background)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'Unrecoverable player error occurred' while playing video during rotation
3 participants