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 ee6bf71..39eb17b 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 b06c8a1..033d9f2 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),