[mythtv] [PATCH] Fixed patch for frontend crash with invalid codecs

Derek Atkins warlord at MIT.EDU
Mon Nov 17 14:08:00 EST 2003


Please ignore my last patch -- there was still a bug with FF/REW.
This one fixes it and now it seems to work fine.

-derek

Index: libs/libmythtv/avformatdecoder.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/avformatdecoder.cpp,v
retrieving revision 1.64
diff -u -r1.64 avformatdecoder.cpp
--- libs/libmythtv/avformatdecoder.cpp	15 Nov 2003 00:56:02 -0000	1.64
+++ libs/libmythtv/avformatdecoder.cpp	17 Nov 2003 19:04:03 -0000
@@ -62,7 +62,8 @@
         for (int i = 0; i < ic->nb_streams; i++) 
         {
             AVStream *st = ic->streams[i];
-            avcodec_close(&st->codec);
+            if (st->codec.codec)
+                avcodec_close(&st->codec);
         } 
 
         ic->iformat->flags |= AVFMT_NOFILE;
@@ -88,7 +89,8 @@
     for (int i = 0; i < ic->nb_streams; i++)
     {
         AVCodecContext *enc = &ic->streams[i]->codec;
-        avcodec_flush_buffers(enc);
+        if (enc->codec)
+            avcodec_flush_buffers(enc);
     }
 
     VideoFrame *buffer;
@@ -1000,6 +1007,13 @@
             }
         }
  
+        if (!curstream->codec.codec)
+        {
+            cerr << "no codec for stream index " << pkt->stream_index << endl;
+            av_free_packet(pkt);
+            continue;
+        }
+
         firstloop = true;
 
         while (len > 0)

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available


More information about the mythtv-dev mailing list