Index: talk/app/webrtc/remoteaudiosource.h |
diff --git a/talk/app/webrtc/remoteaudiosource.h b/talk/app/webrtc/remoteaudiosource.h |
index e49aca56842091e3c29e17c6558c7c727ddc9e11..b0c65aa5221bcb7c13a099584ee06e733754a69f 100644 |
--- a/talk/app/webrtc/remoteaudiosource.h |
+++ b/talk/app/webrtc/remoteaudiosource.h |
@@ -29,23 +29,37 @@ |
#define TALK_APP_WEBRTC_REMOTEAUDIOSOURCE_H_ |
#include <list> |
+#include <string> |
#include "talk/app/webrtc/mediastreaminterface.h" |
#include "talk/app/webrtc/notifier.h" |
+#include "talk/media/base/audiorenderer.h" |
+#include "webrtc/base/criticalsection.h" |
+ |
+namespace rtc { |
+struct Message; |
+class Thread; |
+} // namespace rtc |
namespace webrtc { |
-using webrtc::AudioSourceInterface; |
+class AudioProviderInterface; |
// This class implements the audio source used by the remote audio track. |
-class RemoteAudioSource : public Notifier<AudioSourceInterface> { |
+class RemoteAudioSource : public Notifier<AudioSourceInterface>, |
+ public cricket::AudioRenderer::Sink { |
public: |
// Creates an instance of RemoteAudioSource. |
- static rtc::scoped_refptr<RemoteAudioSource> Create(); |
+ static rtc::scoped_refptr<RemoteAudioSource> Create( |
+ uint32_t ssrc, |
+ AudioProviderInterface* provider); |
+ |
+ void AddSink(AudioTrackSinkInterface* sink); |
+ void RemoveSink(AudioTrackSinkInterface* sink); |
protected: |
- RemoteAudioSource(); |
- virtual ~RemoteAudioSource(); |
+ RemoteAudioSource(uint32_t ssrc, AudioProviderInterface* provider); |
+ ~RemoteAudioSource() override; |
private: |
typedef std::list<AudioObserver*> AudioObserverList; |
@@ -58,7 +72,24 @@ class RemoteAudioSource : public Notifier<AudioSourceInterface> { |
void RegisterAudioObserver(AudioObserver* observer) override; |
void UnregisterAudioObserver(AudioObserver* observer) override; |
+ // cricket::AudioRenderer::Sink implementation. |
+ void OnData(const void* audio_data, |
+ int bits_per_sample, |
+ int sample_rate, |
+ int number_of_channels, |
+ size_t number_of_frames) override; |
+ void OnClose() override; |
+ |
+ class MessageHandler; |
+ void OnMessage(rtc::Message* msg); |
+ |
AudioObserverList audio_observers_; |
+ const uint32_t ssrc_; |
+ AudioProviderInterface* provider_; |
+ rtc::CriticalSection sink_lock_; |
+ std::list<AudioTrackSinkInterface*> sinks_; |
+ rtc::Thread* const main_thread_; |
+ SourceState state_; |
}; |
} // namespace webrtc |