codecs: set sys frame num before new_picture()
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Thu, 23 Apr 2020 10:00:15 +0000 (12:00 +0200)
committerNicolas Dufresne <nicolas@ndufresne.ca>
Thu, 23 Apr 2020 19:54:17 +0000 (19:54 +0000)
Derive classes might need to operate on the current frame at their
new_picture() vmethod, so it would be needed to set system_frame_number
on picture before calling the vmethod.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1209>

gst-libs/gst/codecs/gsth264decoder.c
gst-libs/gst/codecs/gsth265decoder.c

index ee6bf716166a5eacc057231df900c83311bd5795..39eb17b19fdebf78cc1afe1c5b15ff4cc09ff2a8 100644 (file)
@@ -671,6 +671,8 @@ gst_h264_decoder_parse_slice (GstH264Decoder * self, GstH264NalUnit * nalu,
 
     picture = gst_h264_picture_new ();
     picture->pts = pts;
+    /* This allows accessing the frame from the picture. */
+    picture->system_frame_number = priv->current_frame->system_frame_number;
 
     if (klass->new_picture)
       ret = klass->new_picture (self, picture);
@@ -681,8 +683,6 @@ gst_h264_decoder_parse_slice (GstH264Decoder * self, GstH264NalUnit * nalu,
       return FALSE;
     }
 
-    /* This allows accessing the frame from the picture. */
-    picture->system_frame_number = priv->current_frame->system_frame_number;
     priv->current_picture = picture;
     gst_video_codec_frame_set_user_data (priv->current_frame,
         gst_h264_picture_ref (priv->current_picture),
index b06c8a1f1b78a9e3f09c7d3165b740e3253202d5..033d9f26b3dcba955a7a0c032f192dcb05c6bea6 100644 (file)
@@ -395,6 +395,8 @@ gst_h265_decoder_parse_slice (GstH265Decoder * self, GstH265NalUnit * nalu,
 
     picture = gst_h265_picture_new ();
     picture->pts = pts;
+    /* This allows accessing the frame from the picture. */
+    picture->system_frame_number = priv->current_frame->system_frame_number;
 
     if (klass->new_picture)
       ret = klass->new_picture (self, picture);
@@ -405,8 +407,6 @@ gst_h265_decoder_parse_slice (GstH265Decoder * self, GstH265NalUnit * nalu,
       return FALSE;
     }
 
-    /* This allows accessing the frame from the picture. */
-    picture->system_frame_number = priv->current_frame->system_frame_number;
     priv->current_picture = picture;
     gst_video_codec_frame_set_user_data (priv->current_frame,
         gst_h265_picture_ref (priv->current_picture),