diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index d75904cec4b41f939f5cd21e7b98831682d6d0ac..02c75edf9dc7b417a640bb425d61ded283d7a8a0 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -667,8 +667,9 @@ retry:
             s->error_status_table[s->mb_num-1]= AC_ERROR|DC_ERROR|MV_ERROR;
         }
 
+    assert(s->bitstream_buffer_size==0);
     /* divx 5.01+ bistream reorder stuff */
-    if(s->codec_id==CODEC_ID_MPEG4 && s->bitstream_buffer_size==0 && s->divx_packed){
+    if(s->codec_id==CODEC_ID_MPEG4 && s->divx_packed){
         int current_pos= get_bits_count(&s->gb)>>3;
         int startcode_found=0;