diff libmpcodecs/ve_xvid.c @ 17659:92ac78a93625

Fix video delay when encoding with B-frames. Encoding delay is adjusted for on-the-fly during encoding. Decoding delay is compensated for by setting an appropriate dwStart on the audio stream (only in muxer_avi at this point).
author corey
date Tue, 21 Feb 2006 09:39:22 +0000
parents fa17424b4c7b
children 20aca9baf5d8
line wrap: on
line diff
--- a/libmpcodecs/ve_xvid.c	Mon Feb 20 23:50:40 2006 +0000
+++ b/libmpcodecs/ve_xvid.c	Tue Feb 21 09:39:22 2006 +0000
@@ -378,6 +378,10 @@
 
     vbrInit(&fp->vbr_state);
 
+#ifdef XVID_API_UNSTABLE
+    fp->mux->decoder_delay = enc_param.max_bframes ? 1 : 0;
+#endif
+
     return 1;
 }
 
@@ -523,7 +527,10 @@
 #endif
     
     // write output
+    if (fp->enc_frame.length > 0)
     muxer_write_chunk(fp->mux, fp->enc_frame.length, fp->enc_frame.intra==1 ? 0x10 : 0, MP_NOPTS_VALUE, MP_NOPTS_VALUE);
+    else
+		++fp->mux->encoder_delay;
 
     // update the VBR engine
     vbrUpdate(&fp->vbr_state, enc_stats.quant, fp->enc_frame.intra,