codecs: h264decoder: Make get_short_ref_by_pic_num() transfer none
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Wed, 6 May 2020 16:23:34 +0000 (12:23 -0400)
committerNicolas Dufresne <nicolas@ndufresne.ca>
Tue, 19 May 2020 16:57:08 +0000 (16:57 +0000)
We don't use the extra reference, so let's just avoid the extra
ref/unref.

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

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

index e23d8b5afffab286fb243e0731a0331ed1ee4f69..8c9371bf562e6dad68c47e9ec10f383952ef34db 100644 (file)
@@ -1256,7 +1256,6 @@ gst_h264_decoder_handle_memory_management_opt (GstH264Decoder * self,
         to_mark = gst_h264_dpb_get_short_ref_by_pic_num (priv->dpb, pic_num_x);
         if (to_mark) {
           to_mark->ref = FALSE;
-          gst_h264_picture_unref (to_mark);
         } else {
           GST_WARNING_OBJECT (self, "Invalid short term ref pic num to unmark");
           return FALSE;
@@ -1286,7 +1285,6 @@ gst_h264_decoder_handle_memory_management_opt (GstH264Decoder * self,
         if (to_mark) {
           to_mark->long_term = TRUE;
           to_mark->long_term_frame_idx = ref_pic_marking->long_term_frame_idx;
-          gst_h264_picture_unref (to_mark);
         } else {
           GST_WARNING_OBJECT (self,
               "Invalid short term ref pic num to mark as long ref");
index 2d1d6c0d1bfe99b1705b70d4a2e4a8d76c68fd4d..ceb8694e36ed1a6d56d21edd5d71753467c64d95 100644 (file)
@@ -316,7 +316,7 @@ gst_h264_dpb_mark_all_non_ref (GstH264Dpb * dpb)
  *
  * Find a short term reference picture which has matching picture number
  *
- * Returns: (nullable) (transfer full): a #GstH264Picture
+ * Returns: (nullable) (transfer none): a #GstH264Picture
  */
 GstH264Picture *
 gst_h264_dpb_get_short_ref_by_pic_num (GstH264Dpb * dpb, gint pic_num)
@@ -330,7 +330,7 @@ gst_h264_dpb_get_short_ref_by_pic_num (GstH264Dpb * dpb, gint pic_num)
         g_array_index (dpb->pic_list, GstH264Picture *, i);
 
     if (picture->ref && !picture->long_term && picture->pic_num == pic_num)
-      return gst_h264_picture_ref (picture);
+      return picture;
   }
 
   GST_WARNING ("No short term reference picture for %d", pic_num);