-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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 ExoPlayer to 2.14.2 #7005
Conversation
This seems to have introduced a couple of issues with audio. Switching to popup player can sometimes lead to no sound or distorted audio. Here's a log i captured log-newpipe.txt |
thank you @tsiflimagas I was able to reproduce the issue. I will need more time to investigate this |
turns out I was exactly once able to reproduce it. Now tried with logcat running and couldn't reproduce it any more. |
@Redirion
Can we prioritize it? |
Smoke tested it on the following devices:
The following works as expected:
|
I don't understand the changes inside However I would change it like his: diff --git a/app/src/main/java/org/schabi/newpipe/player/resolver/PlaybackResolver.java b/app/src/main/java/org/schabi/newpipe/player/resolver/PlaybackResolver.java
index 48ee305ee..4dc7e7002 100644
--- a/app/src/main/java/org/schabi/newpipe/player/resolver/PlaybackResolver.java
+++ b/app/src/main/java/org/schabi/newpipe/player/resolver/PlaybackResolver.java
@@ -9,6 +9,7 @@ import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.source.MediaSource;
+import com.google.android.exoplayer2.source.MediaSourceFactory;
import com.google.android.exoplayer2.util.Util;
import org.schabi.newpipe.extractor.stream.StreamInfo;
@@ -41,25 +42,29 @@ public interface PlaybackResolver extends Resolver<StreamInfo, MediaSource> {
@NonNull final String sourceUrl,
@C.ContentType final int type,
@NonNull final MediaSourceTag metadata) {
- final Uri uri = Uri.parse(sourceUrl);
+ final MediaSourceFactory factory;
switch (type) {
case C.TYPE_SS:
- return dataSource.getLiveSsMediaSourceFactory().setTag(metadata)
- .createMediaSource(MediaItem.fromUri(uri));
+ factory = dataSource.getLiveSsMediaSourceFactory();
+ break;
case C.TYPE_DASH:
- return dataSource.getLiveDashMediaSourceFactory().setTag(metadata)
- .createMediaSource(
- new MediaItem.Builder()
- .setUri(uri)
- .setLiveTargetOffsetMs(
- PlayerDataSource.LIVE_STREAM_EDGE_GAP_MILLIS)
- .build());
+ factory = dataSource.getLiveDashMediaSourceFactory();
+ break;
case C.TYPE_HLS:
- return dataSource.getLiveHlsMediaSourceFactory().setTag(metadata)
- .createMediaSource(MediaItem.fromUri(uri));
+ factory = dataSource.getLiveHlsMediaSourceFactory();
+ break;
default:
throw new IllegalStateException("Unsupported type: " + type);
}
+
+ return factory.createMediaSource(
+ new MediaItem.Builder()
+ .setTag(metadata)
+ .setUri(Uri.parse(sourceUrl))
+ .setLiveTargetOffsetMs(PlayerDataSource.LIVE_STREAM_EDGE_GAP_MILLIS)
+ .build()
+ );
}
@NonNull
@@ -72,25 +77,30 @@ public interface PlaybackResolver extends Resolver<StreamInfo, MediaSource> {
@C.ContentType final int type = TextUtils.isEmpty(overrideExtension)
? Util.inferContentType(uri) : Util.inferContentType("." + overrideExtension);
+ final MediaSourceFactory factory;
switch (type) {
case C.TYPE_SS:
- return dataSource.getLiveSsMediaSourceFactory().setTag(metadata)
- .createMediaSource(MediaItem.fromUri(uri));
+ factory = dataSource.getLiveSsMediaSourceFactory();
+ break;
case C.TYPE_DASH:
- return dataSource.getDashMediaSourceFactory().setTag(metadata)
- .createMediaSource(MediaItem.fromUri(uri));
+ factory = dataSource.getDashMediaSourceFactory();
+ break;
case C.TYPE_HLS:
- return dataSource.getHlsMediaSourceFactory().setTag(metadata)
- .createMediaSource(MediaItem.fromUri(uri));
+ factory = dataSource.getHlsMediaSourceFactory();
+ break;
case C.TYPE_OTHER:
- return dataSource.getExtractorMediaSourceFactory().setTag(metadata)
- .createMediaSource(
- new MediaItem.Builder()
- .setUri(uri)
- .setCustomCacheKey(cacheKey)
- .build());
+ factory = dataSource.getExtractorMediaSourceFactory();
+ break;
default:
throw new IllegalStateException("Unsupported type: " + type);
}
+
+ return factory.createMediaSource(
+ new MediaItem.Builder()
+ .setTag(metadata)
+ .setUri(uri)
+ .setCustomCacheKey(cacheKey)
+ .build()
+ );
}
} This has a few advantages:
Update from IRC: |
** Updated test results (with above changes) ** Smoke tested it on the following devices:
The following works as expected:
|
* fixes the deprecation of ``setTag`` * makes the code more consistent * de-duplicates some code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thank you litetex |
Woohoo! |
What is it?
Description of the changes in your PR
Fixes the following issue(s)
Since ExoPlayer 2.13 codec capabilities are checked by ExoPlayer which lead to issue #6207. This is a topic affecting some LinageOS users with older SOCs. However I hope that when using LineageOS 18.1 the delegation through MediaParser API will fixthis issue. Feedback is appreciated regarding this!
APK testing
The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR.
Due diligence