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

Update to ExoPlayer 2.11.4 #3513

Merged
merged 1 commit into from
May 17, 2020
Merged

Update to ExoPlayer 2.11.4 #3513

merged 1 commit into from
May 17, 2020

Conversation

Stypox
Copy link
Member

@Stypox Stypox commented May 1, 2020

What is it?

  • Bug fix (user facing)
  • Feature (user facing)
  • Code base improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

This PR updates ExoPlater to 2.11.4, which should hopefully fix some player issues like slowdowns. On my phone and on emulators I noticed that stream loading is (roughly speaking) twice as fast with regards to the old player, but I can't provide a proof ;-)
This PR also includes the changes made by @Redirion in #2859, i.e. making use of two new features: setHandleWakeLock and setHandleAudioBecomingNoisy.
I fixed the bug faced by @Redirion with MaskingMediaSources: the issue was that the new version wraps around MediaSources being fed to it with a MaskingMediaSource, preventing direct access to the original media source. NewPipe made use of this feature in the ManagedMediaSource interface to keep track of whether streams were pre-buffered (probably among other things), by storing stream data inside MediaSources. After some dedication I found out that a way to access the underlying MediaSource of a MaskingMediaSource exists: getTag(). That function can be overridden to return any type of variable, so I made it return this in the ManagedMediaSource interface. I guess this also fixed the issue reported by @TobiGr, i.e. "When changing the resolution while playing, the video stops and the current position jumps to the end".

ExoPlayer release notes: https://github.com/google/ExoPlayer/blob/release-v2/RELEASENOTES.md

Testing apk

I was able to test thoroughly only on my Android 7.0 phone, since on my pc emulators are too slow to play a video and I can't get audio to work with pulseaudio. Anyway I was able to test the basic features on Android API 19 (4.4) and Android API 29 (10) emulators.
app-debug.zip

Agreement

@Stypox Stypox requested a review from Redirion May 1, 2020 20:23
@TobiGr TobiGr added this to the 0.19.4 milestone May 1, 2020
@TobiGr TobiGr added the player Issues related to any player (main, popup and background) label May 1, 2020
@Redirion
Copy link
Member

Redirion commented May 2, 2020

@Stypox that solution looks really nice! Good idea by using that getTag(). Looks like getTag() is just used as a window tag in a dummy timeline (so not really used at all).

@opusforlife2
Copy link
Collaborator

Whoa. I'm getting insane speedups of 5 to 10 times compared to the current release. Most of the time, the loading circle can't even complete one rotation before the video starts playing. This is awesome!

@Stypox
Copy link
Member Author

Stypox commented May 2, 2020

@opusforlife2 are you sure you have the same resolution set as default?

@opusforlife2
Copy link
Collaborator

Of course! That is the first thing I do when I set up a new debug apk. It would have been quite a silly mistake otherwise. 🤣

Copy link
Member

@Redirion Redirion left a comment

Choose a reason for hiding this comment

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

Works fine. The issues I have had with my approach are gone! 👍

@rithans

This comment has been minimized.

@Stypox

This comment has been minimized.

This was referenced May 8, 2020
@wb9688
Copy link
Contributor

wb9688 commented May 9, 2020

I can't play YouTube videos on API 19/21 at resolutions higher than 360p.

Edit: seems to happen on dev as well… :/

@Stypox
Copy link
Member Author

Stypox commented May 9, 2020

@wb9688 maybe it's due to the slowness of the emulator. Or do you mean it crashes?

@wb9688
Copy link
Contributor

wb9688 commented May 9, 2020

@Stypox: Emulator isn't slow at all. It gives an unrecoverable error in a toast (so no crash report :/) when I try to play it. I only tried MPEG-4 though and not WebM yet, but it still shouldn't happen. Try it yourself in an AVD. ;)

@TobiGr
Copy link
Contributor

TobiGr commented May 9, 2020

I can't play YouTube videos on API 19/21 at resolutions higher than 360p.

This happened to me in older versions, too. But with the new exoplayer version I am able to play more videos. We might want to ping one of the people having a KitKat device to test the new player on a real device.

FYI: stacktrace
5-09 10:30:32.955 3635-5772/? E/SoftAVC: Decoder failed: -2
05-09 10:30:32.955 3635-5771/? E/ACodec: [OMX.google.h264.decoder] ERROR(0x80001001)
05-09 10:30:32.955 3635-5770/? E/MediaCodec: Codec reported an error. (omx error 0x80001001, internalError -2147483648)
05-09 10:30:32.965 3635-5628/? E/ExoPlayerImplInternal: Internal runtime error.
    java.lang.IllegalStateException
        at android.media.MediaCodec.dequeueOutputBuffer(Native Method)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.drainOutputBuffer(MediaCodecRenderer.java:1441)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:657)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:575)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:326)
        at android.os.Handler.dispatchMessage(Handler.java:98)
        at android.os.Looper.loop(Looper.java:136)
        at android.os.HandlerThread.run(HandlerThread.java:61)
05-09 10:30:32.965 3635-5628/? E/ExoPlayerImplInternal: Disable failed.
    java.lang.IllegalStateException
        at android.media.MediaCodec.flush(Native Method)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.flushOrReleaseCodec(MediaCodecRenderer.java:706)
        at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.flushOrReleaseCodec(MediaCodecVideoRenderer.java:606)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onDisabled(MediaCodecRenderer.java:584)
        at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onDisabled(MediaCodecVideoRenderer.java:451)
        at com.google.android.exoplayer2.BaseRenderer.disable(BaseRenderer.java:158)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.disableRenderer(ExoPlayerImplInternal.java:1088)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.resetInternal(ExoPlayerImplInternal.java:851)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.stopInternal(ExoPlayerImplInternal.java:813)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:399)
        at android.os.Handler.dispatchMessage(Handler.java:98)
        at android.os.Looper.loop(Looper.java:136)
        at android.os.HandlerThread.run(HandlerThread.java:61)

@Stypox
Copy link
Member Author

Stypox commented May 9, 2020

@domiuns @mqus @jojoxl01 @ask6155 @skil3z you have Android 4.4, right? Could you please test the apk provided above on your device and see if it works correctly? Thank you in advance ;-)

@Stypox Stypox mentioned this pull request May 9, 2020
@jojoxl01
Copy link

jojoxl01 commented May 9, 2020 via email

@wb9688
Copy link
Contributor

wb9688 commented May 9, 2020

@jojoxl01: To be clear: are you saying the behavior is exactly the same as in v0.19.3? Btw was there any previous version last year where it worked correctly?

@jojoxl01
Copy link

jojoxl01 commented May 9, 2020 via email

@jojoxl01
Copy link

jojoxl01 commented May 9, 2020 via email

@jojoxl01
Copy link

jojoxl01 commented May 9, 2020 via email

@mqus
Copy link
Contributor

mqus commented May 9, 2020

you have Android 4.4, right? Could you please test the apk provided above on your device and see if it works correctly? Thank you in advance ;-)

I tested it just now and apart from the usual shenanigans (can't browse soundcloud, the particular peertube video I tried didn't play but downloading it kinda freezed my phone for a while, others played fine) everything worked fine. One thing that I was positively noticing is that peertube lets me resize the popup player more easily then when I last tried (a while ago). But playing videos(fullscreen/popup/background, 360p/1080p60/various) works just fine, although I mostly had MPEG4 videos and only a single webm video. I don't know if there are other codecs I should try. If you have a youtube link with such a case I can try it out.
PS: I have to mention that I didn't have any(recurring) issues before.

@TheDcoder TheDcoder mentioned this pull request May 10, 2020
2 tasks
@ghost
Copy link

ghost commented May 14, 2020

@Stypox I have been testing your debug app for 13 days (since this PR came out), and i have no problem with YouTube....... Yes with YouTube.

I have this problemi with SoundCloud but it is not your fault but my device.

Exception

Crash log

javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x62064ca0: Failure in SSL library, usually a protocol error
error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version (external/openssl/ssl/s23_clnt.c:741 0x59b64890:0x00000000)
	at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:420)
	at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:320)
	at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:284)
	at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:169)
	at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:258)
	at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
	at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:127)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:257)
	at okhttp3.RealCall.execute(RealCall.java:93)
	at org.schabi.newpipe.DownloaderImpl.execute(DownloaderImpl.java:214)
	at org.schabi.newpipe.extractor.downloader.Downloader.get(Downloader.java:70)
	at org.schabi.newpipe.extractor.downloader.Downloader.get(Downloader.java:29)
	at org.schabi.newpipe.extractor.services.soundcloud.SoundcloudParsingHelper.clientId(SoundcloudParsingHelper.java:49)
	at org.schabi.newpipe.extractor.services.soundcloud.SoundcloudChartsExtractor.computeNextPageAndStreams(SoundcloudChartsExtractor.java:54)
	at org.schabi.newpipe.extractor.services.soundcloud.SoundcloudChartsExtractor.getInitialPage(SoundcloudChartsExtractor.java:81)
	at org.schabi.newpipe.extractor.utils.ExtractorHelper.getItemsPageOrLogError(ExtractorHelper.java:19)
	at org.schabi.newpipe.extractor.kiosk.KioskInfo.getInfo(KioskInfo.java:72)
	at org.schabi.newpipe.extractor.kiosk.KioskInfo.getInfo(KioskInfo.java:58)
	at org.schabi.newpipe.util.ExtractorHelper.lambda$getKioskInfo$11(ExtractorHelper.java:184)
	at org.schabi.newpipe.util.-$$Lambda$ExtractorHelper$3nu_IUHVaX-6ert-LLLuUGJnfDU.call(lambda)
	at io.reactivex.internal.operators.single.SingleFromCallable.subscribeActual(SingleFromCallable.java:44)
	at io.reactivex.Single.subscribe(Single.java:3438)
	at io.reactivex.internal.operators.single.SingleDoOnSuccess.subscribeActual(SingleDoOnSuccess.java:35)
	at io.reactivex.Single.subscribe(Single.java:3438)
	at io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run(SingleSubscribeOn.java:89)
	at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:578)
	at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
	at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
	at java.util.concurrent.FutureTask.run(FutureTask.java:234)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:153)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
	at java.lang.Thread.run(Thread.java:838)
Caused by: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x62064ca0: Failure in SSL library, usually a protocol error
error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version (external/openssl/ssl/s23_clnt.c:741 0x59b64890:0x00000000)
	at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_do_handshake(Native Method)
	at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:378)
	... 44 more


@wb9688
Copy link
Contributor

wb9688 commented May 14, 2020

@domiuns: Nothing regarding that (i.e. requested kiosk in SoundCloud) has changed in this PR. I think you should see the same error when using it in the latest released version.

@ghost
Copy link

ghost commented May 14, 2020

@wb9688 yes i have same issues with last release

Copy link
Contributor

@TobiGr TobiGr left a comment

Choose a reason for hiding this comment

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

I've tested this for a while on various devices now and it looks good to me.
@B0pol @wb9688 @Stypox Did you encounter any bugs or is this good to merge?

@wb9688
Copy link
Contributor

wb9688 commented May 16, 2020

@TobiGr: I didn't encounter any bugs. I don't know if using getTag() is the proper way to handle it though.

@Stypox Stypox merged commit c05467f into TeamNewPipe:dev May 17, 2020
@Stypox Stypox deleted the exoplayer branch May 17, 2020 20:02
This was referenced May 29, 2020
@ghost
Copy link

ghost commented May 30, 2020

Latest version still lag as usual on my low end tablet running 4.4 with 512 MB, nothing has really changed. I'm still using MX Player app for better performance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
player Issues related to any player (main, popup and background)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants