Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The FFmpeg fallback already returns audio at
fs, butload_audio_text_image_videoretains the sourceaudio_fsand resamples the decoded waveform again. Forcing the fallback on a generated one-second, 48 kHz WAV withfs=16000, audio_fs=48000produces 5,334 samples on the base commit instead of 16,000. This change returns the expected 16,000 samples.audio_fs = fsafter a successful FFmpeg fallback.input_srfor raw.pcmfiles so their source rate is preserved; direct helper calls still defaultinput_srtosr. Container source rates still come from their headers.audio_fs = fswithout the PCM input-rate change fails five of the six raw-PCM controls.Type of change
Validation
python -m compileall funasr examples testsThe existing CPU CI test selection was run locally with NumPy 1.26.4 and 2.4.0. Each run: 238 passed, 6 skipped, 10 subtests passed. The six skips are real torchaudio decoder controls requiring optional
torchcodec, which the CI environment does not install.With optional
torchcodec==0.10.0installed,python -m pytest -q tests/test_load_audio_bytes.py tests/test_pcm_input_format.py -k 'ffmpeg or normal_decoders'passed all 64 tests, with no skips, including real first-decoder controls. The complete two-file suite in that environment returned 146 passed, 1 failed:TestLoadAudioBytes::test_decodes_big_endian_rifx_wav. That endian-decoding failure reproduces identically on untouched basee7e61293d308f4342ab9307895e710e4b51b949c.pip check, the changed audio-byte test file's Black check, andgit diff --checkpassed.User impact
Preserves audio duration and sample rate when normal decoders fall back to FFmpeg, while retaining raw-PCM source-rate behavior.
Notes for reviewers
This is the earlier audio-loader fallback boundary, separate from the speaker-boundary resampling addressed in #3763. No GPU, model weights, or acoustic-quality evaluation was used. Hosted CI also passed both NumPy matrix jobs on
1d5fd87d933118198075f358dddc7644bc063b42: NumPy 1.26.4 and NumPy 2.4.0.