diff libmpcodecs/ad_spdif.c @ 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 f30c2707e168
children 2b45dfcde03c
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. "