1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-22 16:10:31 +00:00

fix: reset video stream sizes on audio track selection

This commit is contained in:
ThetaDev 2023-03-29 13:39:29 +02:00
parent 694418d30d
commit 39a5c8bdfb
2 changed files with 6 additions and 1 deletions

View File

@ -261,6 +261,7 @@ public class DownloadDialog extends DialogFragment
final StreamSizeWrapper<AudioStream> audioStreams = getWrappedAudioStreams(); final StreamSizeWrapper<AudioStream> audioStreams = getWrappedAudioStreams();
final var secondaryStreams = new SparseArrayCompat<SecondaryStreamHelper<AudioStream>>(4); final var secondaryStreams = new SparseArrayCompat<SecondaryStreamHelper<AudioStream>>(4);
final List<VideoStream> videoStreams = wrappedVideoStreams.getStreamsList(); final List<VideoStream> videoStreams = wrappedVideoStreams.getStreamsList();
wrappedVideoStreams.resetSizes();
for (int i = 0; i < videoStreams.size(); i++) { for (int i = 0; i < videoStreams.size(); i++) {
if (!videoStreams.get(i).isVideoOnly()) { if (!videoStreams.get(i).isVideoOnly()) {

View File

@ -235,7 +235,7 @@ public class StreamItemAdapter<T extends Stream, U extends Stream> extends BaseA
this.unknownSize = context == null this.unknownSize = context == null
? "--.-" : context.getString(R.string.unknown_content); ? "--.-" : context.getString(R.string.unknown_content);
Arrays.fill(streamSizes, -2); resetSizes();
} }
/** /**
@ -269,6 +269,10 @@ public class StreamItemAdapter<T extends Stream, U extends Stream> extends BaseA
.onErrorReturnItem(true); .onErrorReturnItem(true);
} }
public void resetSizes() {
Arrays.fill(streamSizes, -2);
}
public static <X extends Stream> StreamSizeWrapper<X> empty() { public static <X extends Stream> StreamSizeWrapper<X> empty() {
//noinspection unchecked //noinspection unchecked
return (StreamSizeWrapper<X>) EMPTY; return (StreamSizeWrapper<X>) EMPTY;