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

Thomas Guillem git at videolan.org
Mon Jan 29 13:14:05 CET 2018


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

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

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

(cherry picked from commit be994e0f5da80467fa306c9c83418ac1d8b9e9e1)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 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 4d513bf02b..3805066975 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