avcodec/s302m: Only set the sample rate when some data is output
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 5 Jun 2015 22:59:16 +0000 (00:59 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 5 Jun 2015 23:12:06 +0000 (01:12 +0200)
This way ffplay chooses the mp2 stream for Ticket3890

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/s302m.c

index daccbaf..5cf9eb5 100644 (file)
@@ -85,7 +85,6 @@ static int s302m_parse_frame_header(AVCodecContext *avctx, const uint8_t *buf,
         case 8:
             avctx->channel_layout = AV_CH_LAYOUT_5POINT1_BACK | AV_CH_LAYOUT_STEREO_DOWNMIX;
     }
-    avctx->sample_rate = 48000;
     avctx->bit_rate    = 48000 * avctx->channels * (avctx->bits_per_raw_sample + 4) +
                          32 * (48000 / (buf_size * 8 /
                                         (avctx->channels *
@@ -197,6 +196,8 @@ static int s302m_decode_frame(AVCodecContext *avctx, void *data,
         }
     }
 
+    avctx->sample_rate = 48000;
+
     *got_frame_ptr = 1;
 
     return avpkt->size;