TeamNewPipe / NewPipe

A libre lightweight streaming front-end for Android.
https://newpipe.net
GNU General Public License v3.0
30.79k stars 3.01k forks source link

Video player crashes when in landscape mode #10070

Open nicolascolla opened 1 year ago

nicolascolla commented 1 year ago

Checklist

Affected version

0.25.1

Steps to reproduce the bug

  1. Open any video
  2. Hit play
  3. Put phone in landscape mode

Expected behavior

Video should play

Actual behavior

The video player crashes instantly when the screen is put in landscape mode.

Screenshots/Screen recordings

No response

Logs

Xiaomi Redmi Note 9 running LineageOS 20. The video player crashes when the screen is in landscape mode. The video player works in portrait, but will instantly crash when the screen is rotated.

Exception

com.google.android.exoplayer2.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(137, null, null, video/avc, avc1.640028, 4578418, null, [1920, 1080, 30.0], [-1, -1]), format_supported=YES
    at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:578)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: com.google.android.exoplayer2.video.MediaCodecVideoDecoderException: Decoder failed: c2.android.avc.decoder
    at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.createDecoderException(MediaCodecVideoRenderer.java:1639)
    at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:795)
    at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1007)
    at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:502)
    ... 4 more
Caused by: java.lang.IllegalStateException
    at android.media.MediaCodec.releaseOutputBuffer(Native Method)
    at android.media.MediaCodec.releaseOutputBufferInternal(MediaCodec.java:3688)
    at android.media.MediaCodec.releaseOutputBuffer(MediaCodec.java:3662)
    at com.google.android.exoplayer2.mediacodec.AsynchronousMediaCodecAdapter.releaseOutputBuffer(AsynchronousMediaCodecAdapter.java:189)
    at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.renderOutputBufferV21(MediaCodecVideoRenderer.java:1374)
    at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.processOutputBuffer(MediaCodecVideoRenderer.java:1137)
    at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.drainOutputBuffer(MediaCodecRenderer.java:1881)
    at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:774)
    ... 6 more


Affected Android/Custom ROM version

LineageOS 20

Affected device model

Xiaomi Redmi Note 9

Additional information

No response

opusforlife2 commented 1 year ago

Download a debug APK of Newpipe from one of the PRs, and go into the Exoplayer settings menu under Video and audio. Try the toggles one by one to see if it changes things. Most likely the set_surface one.

nicolascolla commented 1 year ago

Download a debug APK of Newpipe from one of the PRs, and go into the Exoplayer settings menu under Video and audio. Try the toggles one by one to see if it changes things. Most likely the set_surface one.

I have downloaded a debug APK from https://github.com/TeamNewPipe/NewPipe/pull/10062. Video rotation works as-is without having to try any of the toggles.

I have also downloaded the 0.25.0 release. It also works well.

But when I install the 0.25.1 release APK, both from F-Droid and Github, the issue persists.

Back to the debug APK, I can confirm that none of the three toggles under Video and audio -> Exoplayer settings make the app crash, at least when enabled individually. I remain available for further testing.

nicolascolla commented 1 year ago

After rolling back to 0.25.0, I have been able to reproduce this bug in it, too.

It seems to happen when video quality is set at 1080p or higher. 720p or less always runs fine. After realizing this, I have tried the debug APK again and the surface toggle does, in fact, solve the crashes, as you mentioned, although it introduces a three-second black screen when switching to full screen and video has pretty bad performance (lots of skipped frames).

I can also confirm that 1080p video works perfectly under MIUI on the same device.

philibeur commented 1 year ago

Hello, i have similary issue: Samsung a7 2018, android 10, newpipe 25.1

Exception

com.google.android.exoplayer2.ExoPlaybackException: Unexpected runtime error at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:628) at android.os.Handler.dispatchMessage(Handler.java:103) at android.os.Looper.loop(Looper.java:237) at android.os.HandlerThread.run(HandlerThread.java:67) Caused by: java.lang.IllegalArgumentException at android.media.MediaCodec.native_setSurface(Native Method) at android.media.MediaCodec.setOutputSurface(MediaCodec.java:2042) at com.google.android.exoplayer2.mediacodec.AsynchronousMediaCodecAdapter$$ExternalSyntheticApiModelOutline0.m(R8$$SyntheticClass:0) at com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter.setOutputSurface(SynchronousMediaCodecAdapter.java:189) at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.setOutputSurfaceV23(MediaCodecVideoRenderer.java:1500) at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.setOutput(MediaCodecVideoRenderer.java:694) at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.handleMessage(MediaCodecVideoRenderer.java:632) at com.google.android.exoplayer2.ExoPlayerImplInternal.deliverMessage(ExoPlayerImplInternal.java:1565) at com.google.android.exoplayer2.ExoPlayerImplInternal.sendMessageToTarget(ExoPlayerImplInternal.java:1529) at com.google.android.exoplayer2.ExoPlayerImplInternal.sendMessageInternal(ExoPlayerImplInternal.java:1504) at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:533) ... 3 more

Gipsysoftware commented 1 year ago

Exception

android.app.ForegroundServiceDidNotStartInTimeException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{191039e u0 org.schabi.newpipe/.player.PlayerService}
    at android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:2053)
    at android.app.ActivityThread.access$2800(ActivityThread.java:253)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2282)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:233)
    at android.os.Looper.loop(Looper.java:344)
    at android.app.ActivityThread.main(ActivityThread.java:8191)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)


ech0devv commented 4 months ago

This issue is still happening in a few apps on hyperos

WhiteChairFromIkea commented 1 month ago

I do not get a crash (app is still running), but video to be played becomes forgotten:

  1. In non landscape: keep something played;
  2. Click on an unplayed item in playlist;
  3. Quickly rotate the screen;
  4. App switches to landscape with unexpected state:

A. No fullscreen B. Previous video is seen in exo, paused C. Requested video is not going to be loaded and played.

Expected: D. Player should be in full screen and started playing the video requested (as clicked in the playlist right before rotation)

Is this the same bug as in this issue or should I report new one?

opusforlife2 commented 1 month ago

Did you try the three Exoplayer toggles mentioned above?

WhiteChairFromIkea commented 1 month ago

Did you try the three Exoplayer toggles mentioned above?

thanks, it seems middle toggle works (testing for two days). The third one caused black screen after rotation (reverted back to visible view by locking nd unlocking the phone). So far seems good with 2nd toggle switch, thanks :)