gstmediasourcetrack: Ref the sample inside push() method

This simplifies cleanup for the caller since the push method already cleans up
the sample when it is consumed by playback or if it fails to be added to the
queue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8512>
This commit is contained in:
Jordan Yelloz 2025-02-18 13:08:37 -07:00 committed by GStreamer Marge Bot
parent 4f5cda94f7
commit 537065b29e
2 changed files with 2 additions and 1 deletions

View File

@ -345,7 +345,7 @@ gst_media_source_track_push (GstMediaSourceTrack * self, GstSample * sample)
gboolean was_empty = gst_media_source_track_is_empty (self);
GstDataQueueItem *item = wrap_sample (sample);
GstDataQueueItem *item = wrap_sample (gst_sample_ref (sample));
gboolean result = gst_data_queue_push (self->samples, item);

View File

@ -609,6 +609,7 @@ GST_START_TEST (test_track_push_with_adequate_space)
GstSample *sample = gst_sample_new (buffer, NULL, NULL, NULL);
gboolean result = gst_media_source_track_push (track, sample);
fail_unless (result);
gst_sample_unref (sample);
gst_buffer_unref (buffer);
gst_object_unref (track);
}