avcodec/encoder: fallback to 44100hz when rate is not supported
authorThomas Guillem <thomas@gllm.fr>
Sat, 27 Jan 2018 17:19:16 +0000 (18:19 +0100)
committerThomas Guillem <thomas@gllm.fr>
Sat, 27 Jan 2018 17:19:16 +0000 (18:19 +0100)
Better than faling, the transcode sout will convert the rate.

modules/codec/avcodec/encoder.c

index 78a8ca4..1c2bd24 100644 (file)
@@ -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++ )