WMAL: do not start decoding if frame does not end in current packet
authorMashiat Sarker Shakkhar <mashiat.sarker@gmail.com>
Mon, 30 Apr 2012 15:56:35 +0000 (08:56 -0700)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Tue, 1 May 2012 12:33:31 +0000 (14:33 +0200)
This fixes decoding of frames which span more than two packets. Tested with
recit24.wma.

Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
libavcodec/wmalosslessdec.c

index 1520a06..e86645e 100644 (file)
@@ -1209,8 +1209,8 @@ static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr,
             save_bits(s, gb, num_bits_prev_frame, 1);
 
             /* decode the cross packet frame if it is valid */
-            if (!s->packet_loss)
-                decode_frame(s);
+            if (num_bits_prev_frame < remaining_packet_bits && !s->packet_loss)
+                    decode_frame(s);
         } else if (s->num_saved_bits - s->frame_offset) {
             av_dlog(avctx, "ignoring %x previously saved bits\n",
                     s->num_saved_bits - s->frame_offset);