|
|
@@ -2774,8 +2774,18 @@ static int audio_open(FFPlayer *opaque, int64_t wanted_channel_layout, int wante
|
|
|
av_log(NULL, AV_LOG_ERROR, "Invalid sample rate or channel count!\n");
|
|
|
return -1;
|
|
|
}
|
|
|
- while (next_sample_rate_idx && next_sample_rates[next_sample_rate_idx] >= wanted_spec.freq)
|
|
|
- next_sample_rate_idx--;
|
|
|
+// while (next_sample_rate_idx && next_sample_rates[next_sample_rate_idx] >= wanted_spec.freq)
|
|
|
+// next_sample_rate_idx--;
|
|
|
+ //修复dsf dff格式的播放
|
|
|
+ if (wanted_spec.freq > next_sample_rates[next_sample_rate_idx]) {
|
|
|
+ av_log(NULL, AV_LOG_INFO, "A high sampling rate of %d Hz has been detected, forcing fallback to %d Hz\n",
|
|
|
+ wanted_spec.freq, next_sample_rates[next_sample_rate_idx]);
|
|
|
+ wanted_spec.freq = next_sample_rates[next_sample_rate_idx];
|
|
|
+ } else {
|
|
|
+ while (next_sample_rate_idx && next_sample_rates[next_sample_rate_idx] >= wanted_spec.freq) {
|
|
|
+ next_sample_rate_idx--;
|
|
|
+ }
|
|
|
+ }
|
|
|
wanted_spec.format = AUDIO_S16SYS;
|
|
|
wanted_spec.silence = 0;
|
|
|
wanted_spec.samples = FFMAX(SDL_AUDIO_MIN_BUFFER_SIZE, 2 << av_log2(wanted_spec.freq / SDL_AoutGetAudioPerSecondCallBacks(ffp->aout)));
|