[FFmpeg-cvslog] doc/examples/encode_audio: Favor a sample rate close to 44khz instead of the maximum sample rate
Michael Niedermayer
git at videolan.org
Thu Mar 30 17:40:13 EEST 2017
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Thu Mar 30 15:12:19 2017 +0200| [59b8c2a4e668d129dedfab696cd8c07f5103343c] | committer: Michael Niedermayer
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 at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=59b8c2a4e668d129dedfab696cd8c07f5103343c
---
doc/examples/encode_audio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/doc/examples/encode_audio.c b/doc/examples/encode_audio.c
index 88d0a6f..ba9ef6d 100644
--- a/doc/examples/encode_audio.c
+++ b/doc/examples/encode_audio.c
@@ -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;
More information about the ffmpeg-cvslog
mailing list