changeset 35423:eef7c4527712

Do not fall back to 0 for samplerate when parser is not initialized. Might fix some issues with using -ac spdifenc with audio in MKV or MP4.
author reimar
date Thu, 29 Nov 2012 17:03:04 +0000
parents 696a8a165952
children 7f73ecc9ccda
files libmpcodecs/ad_spdif.c
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_spdif.c	Thu Nov 29 15:10:27 2012 +0000
+++ b/libmpcodecs/ad_spdif.c	Thu Nov 29 17:03:04 2012 +0000
@@ -137,7 +137,6 @@
     }
 
     // get sample_rate & bitrate from parser
-    bps = srate = 0;
     x = ds_get_packet_pts(sh->ds, &start, &pts);
     in_size = x;
     if (x <= 0) {
@@ -145,10 +144,9 @@
         x = 0;
     }
     ds_parse(sh->ds, &start, &x, pts, 0);
-    if (x == 0) { // not enough buffer
-        srate = 48000;    //fake value
-        bps   = 768000/8; //fake value
-    } else  if (sh->avctx) {
+    srate = 48000;    //fake value
+    bps   = 768000/8; //fake value
+    if (x && sh->avctx) { // we have parser and large enough buffer
         if (sh->avctx->sample_rate < 44100) {
             mp_msg(MSGT_DECAUDIO,MSGL_INFO,
                    "This stream sample_rate[%d Hz] may be broken. "