Fix segfault in audioomx
authorMarten Richter <marten.richter@freenet.de>
Sat, 6 Oct 2012 17:49:09 +0000 (19:49 +0200)
committerMarten Richter <marten.richter@freenet.de>
Sat, 6 Oct 2012 17:49:09 +0000 (19:49 +0200)
audioomx.cc

index 031adb0543cc2382c9d9870c8f4b8761a32f980b..6fed499587145018e23b734de260916aeb2ad1d7 100644 (file)
@@ -1488,6 +1488,7 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer,
 
        }
 
+       if (*samplepos>packet.length) *samplepos=0; //propably the thread got interrupted and sample is not valid any more!
        unsigned int haveToCopy=packet.length-*samplepos;
        if (passthrough) {
                //TODO
@@ -1550,6 +1551,7 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer,
                                };
                                if (adv > 0) {
                                        incoming_paket_libav.data += adv;
+                                       incoming_paket_libav.size-=adv;
                                        haveToCopy -= adv;
                                        *samplepos += adv;
                                        /*if (current_context->frame_size>0) framesize=min(current_context->frame_size,haveToCopy);