Skip to content

Conversation

Stypox
Copy link
Member

@Stypox Stypox commented Mar 28, 2024

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

This PR contains 4 commits:

  • The non-desugared toArray(IntFunction) method was being used when loading download missions. The desugaring documentation reports it as "Not supported at all minSDK levels". This bug was introduced by f9fc1cd. I checked and there no other places where toArray(IntFunction) is used.

  • There were some logical flaws in the getAudioStreamFor function, which is used to choose the audio stream to mux with a video-only stream when downloading. Before the code correctly chose WEBMA or WEBMA_OPUS audio for WEBM videos, and M4A audio for MPEG_4 videos. But after commit 77bbbc8 the code only "prefers" choosing the correct format, but can still return an invalid audio format for a specific video format, since only Comparators are used with no filtering. This is fixed by basically restoring the previous behavior (but without discarding the improvements in 77bbbc8 related to isLimitingDataUsage), that is:

    • an MPEG4 video can only be muxed with an M4A audio
    • a WEBM video can only be muxed with either a WEBMA audio, or a WEBMA_OPUS audio

    Now if there is no valid audio format corresponding to a video format, the video will be downloaded without audio:
    image

  • DownloadDialog.onDismissListener was not used anymore, so I removed it

  • When DownloadDialog.onCreate() is called, if there is no storage permission on old Android versions, the dialog is dismissed without continuing initialization. However, for some reason, Android still calls DownloadDialog.onViewCreated() afterwards, which obviously requires the initialization in onCreate() to have completed, thus causing a NPE. This is fixed by adding a check to detect if the dialog was dismissed before initializing.

Fixes the following issue(s)

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. You can find more info and a video demonstration on this wiki page.

Due diligence

Copy link

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.

Changes lgtm

@Stypox Stypox merged commit 3f94e7b into TeamNewPipe:dev Mar 28, 2024
@Stypox Stypox mentioned this pull request Apr 1, 2024
8 tasks
@Stypox Stypox deleted the download-fixes branch July 16, 2025 13:54
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 downloader Issue is related to the downloader size/medium PRs with less than 250 changed lines

Projects

None yet

3 participants