Skip to content

Commit

Permalink
[GStreamer] Clean-up GstSample ref handling in MediaSampleGStreamer
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=274254

Reviewed by Michael Catanzaro.

The MediaSampleGStreamer constructor consumes GstSample references, so they should be moved
accordingly.

* Source/WebCore/platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
(WebCore::MediaSampleGStreamer::MediaSampleGStreamer):
(WebCore::MediaSampleGStreamer::createNonDisplayingCopy const):

Canonical link: https://commits.webkit.org/278912@main
  • Loading branch information
philn committed May 17, 2024
1 parent 84c5089 commit 20f2c49
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ MediaSampleGStreamer::MediaSampleGStreamer(GRefPtr<GstSample>&& sample, const Fl
, m_presentationSize(presentationSize)
{
ASSERT(sample);
m_sample = sample;
m_sample = WTFMove(sample);
const GstClockTime minimumDuration = 1000; // 1 us
auto* buffer = gst_sample_get_buffer(m_sample.get());
RELEASE_ASSERT(buffer);
Expand Down Expand Up @@ -142,7 +142,7 @@ Ref<MediaSample> MediaSampleGStreamer::createNonDisplayingCopy() const
GstStructure* info = originalInfo ? gst_structure_copy(originalInfo) : nullptr;
GRefPtr<GstSample> sample = adoptGRef(gst_sample_new(buffer, caps, segment, info));

return adoptRef(*new MediaSampleGStreamer(sample.get(), m_presentationSize, m_trackId));
return adoptRef(*new MediaSampleGStreamer(WTFMove(sample), m_presentationSize, m_trackId));
}

void MediaSampleGStreamer::dump(PrintStream& out) const
Expand Down

0 comments on commit 20f2c49

Please sign in to comment.