Skip to content

Commit

Permalink
Fix incorrect storage of AudioSourceProviderGStreamer
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=264119

Unreviewed stable branch commit. We cannot store refcounted objects in a
std::unique_ptr since the object may be deleted with an outstanding
reference.

* Source/WebCore/platform/audio/gstreamer/AudioSourceProviderGStreamer.h:
* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::ensureAudioSourceProvider):
* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
  • Loading branch information
mcatanzaro committed Nov 3, 2023
1 parent 6ea0a0e commit e2a2dcf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ namespace WebCore {
#if ENABLE(MEDIA_STREAM)
class AudioSourceProviderGStreamer final : public WebAudioSourceProvider {
public:
static Ref<AudioSourceProviderGStreamer> create()
{
return adoptRef(*new AudioSourceProviderGStreamer());
}
static Ref<AudioSourceProviderGStreamer> create(MediaStreamTrackPrivate& source)
{
return adoptRef(*new AudioSourceProviderGStreamer(source));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ void MediaPlayerPrivateGStreamer::simulateAudioInterruption()
void MediaPlayerPrivateGStreamer::ensureAudioSourceProvider()
{
if (!m_audioSourceProvider)
m_audioSourceProvider = makeUnique<AudioSourceProviderGStreamer>();
m_audioSourceProvider = AudioSourceProviderGStreamer::create();
}

AudioSourceProvider* MediaPlayerPrivateGStreamer::audioSourceProvider()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface
AtomString m_requestedTextStreamId;

#if ENABLE(WEB_AUDIO)
std::unique_ptr<AudioSourceProviderGStreamer> m_audioSourceProvider;
RefPtr<AudioSourceProviderGStreamer> m_audioSourceProvider;
#endif
GRefPtr<GstElement> m_downloadBuffer;

Expand Down

0 comments on commit e2a2dcf

Please sign in to comment.