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:
parent
4f5cda94f7
commit
537065b29e
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user