[vlc-commits] avcodec/encoder: fallback to 44100hz when rate is not supported

Thomas Guillem git at videolan.org
Sat Jan 27 18:19:32 CET 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Sat Jan 27 18:19:16 2018 +0100| [be994e0f5da80467fa306c9c83418ac1d8b9e9e1] | committer: Thomas Guillem

avcodec/encoder: fallback to 44100hz when rate is not supported

Better than faling, the transcode sout will convert the rate.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=be994e0f5da80467fa306c9c83418ac1d8b9e9e1
---

 modules/codec/avcodec/encoder.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 78a8ca4e05..1c2bd24bf5 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -911,10 +911,11 @@ errmsg:
 
             if ( i_frequency == 6 )
             {
-                msg_Err( p_enc, "MPEG audio doesn't support frequency=%d",
+                msg_Warn( p_enc, "MPEG audio doesn't support frequency=%d",
                         fmt->audio.i_rate );
-                av_dict_free(&options);
-                goto error;
+                /* Fallback to 44100 hz */
+                p_context->sample_rate = p_enc->fmt_in.audio.i_rate =
+                p_enc->fmt_out.audio.i_rate = 44100;
             }
 
             for ( i = 1; i < 14; i++ )



More information about the vlc-commits mailing list