Skip to content
Snippets Groups Projects
Commit 59b8c2a4 authored by Michael Niedermayer's avatar Michael Niedermayer
Browse files

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: default avatarSteven Liu <lingjiujianke@gmail.com>
Signed-off-by: default avatarMichael Niedermayer <michael@niedermayer.cc>
parent 004f27f0
No related branches found
No related tags found
No related merge requests found
...@@ -62,7 +62,8 @@ static int select_sample_rate(const AVCodec *codec) ...@@ -62,7 +62,8 @@ static int select_sample_rate(const AVCodec *codec)
p = codec->supported_samplerates; p = codec->supported_samplerates;
while (*p) { while (*p) {
best_samplerate = FFMAX(*p, best_samplerate); if (!best_samplerate || abs(44100 - *p) < abs(44100 - best_samplerate))
best_samplerate = *p;
p++; p++;
} }
return best_samplerate; return best_samplerate;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment