]> git.videolan.org Git - x264.git/commitdiff
Fix nalu_process callback with HRD
authorKieran Kunhya <kieran@kunhya.com>
Wed, 13 Jul 2011 19:25:40 +0000 (20:25 +0100)
committerJason Garrett-Glaser <jason@x264.com>
Thu, 14 Jul 2011 23:37:57 +0000 (16:37 -0700)
encoder/encoder.c

index 85ad04614beee7d86ebaf16bd32236c6aa03f874..633da2a1676af7d7c87bcf1a64219fba18022a7a 100644 (file)
@@ -2835,7 +2835,16 @@ int     x264_encoder_encode( x264_t *h,
             overhead += h->out.nal[h->out.i_nal-1].i_payload + NALU_OVERHEAD;
         }
 
-        /* buffering period sei is written in x264_encoder_frame_end */
+        /* when frame threading is used, buffering period sei is written in x264_encoder_frame_end */
+        if( h->i_thread_frames == 1 && h->sps->vui.b_nal_hrd_parameters_present )
+        {
+            x264_hrd_fullness( h );
+            x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+            x264_sei_buffering_period_write( h, &h->out.bs );
+            if( x264_nal_end( h ) )
+               return -1;
+            overhead += h->out.nal[h->out.i_nal-1].i_payload + NALU_OVERHEAD;
+        }
     }
 
     /* write extra sei */
@@ -2979,8 +2988,8 @@ static int x264_encoder_frame_end( x264_t *h, x264_t *thread_current,
     }
 
     x264_emms();
-    /* generate sei buffering period and insert it into place */
-    if( h->fenc->b_keyframe && h->sps->vui.b_nal_hrd_parameters_present )
+    /* generate buffering period sei and insert it into place */
+    if( h->i_thread_frames > 1 && h->fenc->b_keyframe && h->sps->vui.b_nal_hrd_parameters_present )
     {
         x264_hrd_fullness( h );
         x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );