RealtimeOutgoingAudioSource subclasses should observe its source when fully constructed
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Nov 2018 15:32:03 +0000 (15:32 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Nov 2018 15:32:03 +0000 (15:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191241

Reviewed by Eric Carlson.

Moving the logic to observe the audio source to the point where the
RealtimeOutgoingAudioSource subclass is fully initialized.
Covered by existing tests.

* platform/mediastream/RealtimeOutgoingAudioSource.cpp:
(WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
(WebCore::RealtimeOutgoingAudioSource::observeSource):
* platform/mediastream/RealtimeOutgoingAudioSource.h:
* platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::RealtimeOutgoingAudioSourceLibWebRTC):
* platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp:
(WebCore::RealtimeOutgoingAudioSourceCocoa::RealtimeOutgoingAudioSourceCocoa):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237802 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.cpp
Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.h
Source/WebCore/platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp
Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp

index f85ec1f..c555b89 100644 (file)
@@ -1,3 +1,23 @@
+2018-11-05  Youenn Fablet  <youenn@apple.com>
+
+        RealtimeOutgoingAudioSource subclasses should observe its source when fully constructed
+        https://bugs.webkit.org/show_bug.cgi?id=191241
+
+        Reviewed by Eric Carlson.
+
+        Moving the logic to observe the audio source to the point where the
+        RealtimeOutgoingAudioSource subclass is fully initialized.
+        Covered by existing tests.
+
+        * platform/mediastream/RealtimeOutgoingAudioSource.cpp:
+        (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
+        (WebCore::RealtimeOutgoingAudioSource::observeSource):
+        * platform/mediastream/RealtimeOutgoingAudioSource.h:
+        * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
+        (WebCore::RealtimeOutgoingAudioSourceLibWebRTC::RealtimeOutgoingAudioSourceLibWebRTC):
+        * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp:
+        (WebCore::RealtimeOutgoingAudioSourceCocoa::RealtimeOutgoingAudioSourceCocoa):
+
 2018-11-05  Thibault Saunier  <tsaunier@igalia.com>
 
         [GStreamer][WebRTC] Add webrtcencoder bin to cleanup and refactor the way we set encoders
index 6090f0e..afa13e1 100644 (file)
 
 namespace WebCore {
 
-RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource(Ref<MediaStreamTrackPrivate>&& audioSource)
-    : m_audioSource(WTFMove(audioSource))
+RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource(Ref<MediaStreamTrackPrivate>&& source)
+    : m_audioSource(WTFMove(source))
+{
+}
+
+void RealtimeOutgoingAudioSource::observeSource()
 {
     m_audioSource->addObserver(*this);
     initializeConverter();
index c3ea572..8651ed1 100644 (file)
@@ -64,6 +64,8 @@ public:
 protected:
     explicit RealtimeOutgoingAudioSource(Ref<MediaStreamTrackPrivate>&&);
 
+    void observeSource();
+
     virtual void pullAudioData() { }
 
     bool isSilenced() const { return m_muted || !m_enabled; }
index 1115d06..0120ac0 100644 (file)
@@ -34,6 +34,7 @@ RealtimeOutgoingAudioSourceLibWebRTC::RealtimeOutgoingAudioSourceLibWebRTC(Ref<M
 {
     m_adapter = adoptGRef(gst_adapter_new()),
     m_sampleConverter = nullptr;
+    observeSource();
 }
 
 RealtimeOutgoingAudioSourceLibWebRTC::~RealtimeOutgoingAudioSourceLibWebRTC()
index 4ab406d..c0ea324 100644 (file)
@@ -47,6 +47,7 @@ RealtimeOutgoingAudioSourceCocoa::RealtimeOutgoingAudioSourceCocoa(Ref<MediaStre
     : RealtimeOutgoingAudioSource(WTFMove(audioSource))
     , m_sampleConverter(AudioSampleDataSource::create(LibWebRTCAudioFormat::sampleRate * 2))
 {
+    observeSource();
 }
 
 Ref<RealtimeOutgoingAudioSource> RealtimeOutgoingAudioSource::create(Ref<MediaStreamTrackPrivate>&& audioSource)