1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

doc/examples/encode_audio: Favor a sample rate close to 44khz instead of the maximum sample rate

This is an example, people will copy and use this. The maximum supported is quite
unreasonable as a default choice

Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2017-03-30 15:12:19 +02:00
parent 004f27f0fb
commit 59b8c2a4e6

View File

@ -62,7 +62,8 @@ static int select_sample_rate(const AVCodec *codec)
p = codec->supported_samplerates;
while (*p) {
best_samplerate = FFMAX(*p, best_samplerate);
if (!best_samplerate || abs(44100 - *p) < abs(44100 - best_samplerate))
best_samplerate = *p;
p++;
}
return best_samplerate;