Chromium Code Reviews| OLD | NEW | 
|---|---|
| 1 /* | 1 /* | 
| 2 * Copyright 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2014 The WebRTC project authors. All Rights Reserved. | 
| 3 * | 3 * | 
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license | 
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source | 
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found | 
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may | 
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. | 
| 9 */ | 9 */ | 
| 10 | 10 | 
| 11 #ifndef WEBRTC_API_REMOTEAUDIOSOURCE_H_ | 11 #ifndef WEBRTC_API_REMOTEAUDIOSOURCE_H_ | 
| 12 #define WEBRTC_API_REMOTEAUDIOSOURCE_H_ | 12 #define WEBRTC_API_REMOTEAUDIOSOURCE_H_ | 
| 13 | 13 | 
| 14 #include <list> | 14 #include <list> | 
| 15 #include <string> | 15 #include <string> | 
| 16 | 16 | 
| 17 #include "webrtc/api/mediastreaminterface.h" | |
| 18 #include "webrtc/api/notifier.h" | 17 #include "webrtc/api/notifier.h" | 
| 19 #include "webrtc/audio_sink.h" | 18 #include "webrtc/audio_sink.h" | 
| 20 #include "webrtc/base/criticalsection.h" | 19 #include "webrtc/base/criticalsection.h" | 
| 20 #include "webrtc/pc/channel.h" | |
| 21 | 21 | 
| 22 namespace rtc { | 22 namespace rtc { | 
| 23 struct Message; | 23 struct Message; | 
| 24 class Thread; | 24 class Thread; | 
| 25 } // namespace rtc | 25 } // namespace rtc | 
| 26 | 26 | 
| 27 namespace webrtc { | 27 namespace webrtc { | 
| 28 | 28 | 
| 29 class AudioProviderInterface; | |
| 30 | |
| 31 // This class implements the audio source used by the remote audio track. | 29 // This class implements the audio source used by the remote audio track. | 
| 32 class RemoteAudioSource : public Notifier<AudioSourceInterface> { | 30 class RemoteAudioSource : public Notifier<AudioSourceInterface> { | 
| 
 
pthatcher1
2016/06/21 07:45:41
It sounds like this should be in pc/, not api/.
 
Taylor Brandstetter
2016/06/22 00:50:17
Yep. Same with most things currently in /api/.
 
 | |
| 33 public: | 31 public: | 
| 34 // Creates an instance of RemoteAudioSource. | 32 // Creates an instance of RemoteAudioSource. | 
| 35 static rtc::scoped_refptr<RemoteAudioSource> Create( | 33 static rtc::scoped_refptr<RemoteAudioSource> Create( | 
| 36 uint32_t ssrc, | 34 uint32_t ssrc, | 
| 37 AudioProviderInterface* provider); | 35 cricket::VoiceChannel* channel); | 
| 
 
pthatcher1
2016/06/21 07:45:41
Could this take an RtpReceiver instead?
 
Taylor Brandstetter
2016/06/22 00:50:17
I agree some refactoring is in order here, but I d
 
 | |
| 38 | 36 | 
| 39 // MediaSourceInterface implementation. | 37 // MediaSourceInterface implementation. | 
| 40 MediaSourceInterface::SourceState state() const override; | 38 MediaSourceInterface::SourceState state() const override; | 
| 41 bool remote() const override; | 39 bool remote() const override; | 
| 42 | 40 | 
| 43 void AddSink(AudioTrackSinkInterface* sink) override; | 41 void AddSink(AudioTrackSinkInterface* sink) override; | 
| 44 void RemoveSink(AudioTrackSinkInterface* sink) override; | 42 void RemoveSink(AudioTrackSinkInterface* sink) override; | 
| 45 | 43 | 
| 46 protected: | 44 protected: | 
| 47 RemoteAudioSource(); | 45 RemoteAudioSource(); | 
| 48 ~RemoteAudioSource() override; | 46 ~RemoteAudioSource() override; | 
| 49 | 47 | 
| 50 // Post construction initialize where we can do things like save a reference | 48 // Post construction initialize where we can do things like save a reference | 
| 51 // to ourselves (need to be fully constructed). | 49 // to ourselves (need to be fully constructed). | 
| 52 void Initialize(uint32_t ssrc, AudioProviderInterface* provider); | 50 void Initialize(uint32_t ssrc, cricket::VoiceChannel* channel); | 
| 53 | 51 | 
| 54 private: | 52 private: | 
| 55 typedef std::list<AudioObserver*> AudioObserverList; | 53 typedef std::list<AudioObserver*> AudioObserverList; | 
| 56 | 54 | 
| 57 // AudioSourceInterface implementation. | 55 // AudioSourceInterface implementation. | 
| 58 void SetVolume(double volume) override; | 56 void SetVolume(double volume) override; | 
| 59 void RegisterAudioObserver(AudioObserver* observer) override; | 57 void RegisterAudioObserver(AudioObserver* observer) override; | 
| 60 void UnregisterAudioObserver(AudioObserver* observer) override; | 58 void UnregisterAudioObserver(AudioObserver* observer) override; | 
| 61 | 59 | 
| 62 class Sink; | 60 class Sink; | 
| 63 void OnData(const AudioSinkInterface::Data& audio); | 61 void OnData(const AudioSinkInterface::Data& audio); | 
| 64 void OnAudioProviderGone(); | 62 void OnAudioChannelGone(); | 
| 65 | 63 | 
| 66 class MessageHandler; | 64 class MessageHandler; | 
| 67 void OnMessage(rtc::Message* msg); | 65 void OnMessage(rtc::Message* msg); | 
| 68 | 66 | 
| 69 AudioObserverList audio_observers_; | 67 AudioObserverList audio_observers_; | 
| 70 rtc::CriticalSection sink_lock_; | 68 rtc::CriticalSection sink_lock_; | 
| 71 std::list<AudioTrackSinkInterface*> sinks_; | 69 std::list<AudioTrackSinkInterface*> sinks_; | 
| 72 rtc::Thread* const main_thread_; | 70 rtc::Thread* const main_thread_; | 
| 73 SourceState state_; | 71 SourceState state_; | 
| 74 }; | 72 }; | 
| 75 | 73 | 
| 76 } // namespace webrtc | 74 } // namespace webrtc | 
| 77 | 75 | 
| 78 #endif // WEBRTC_API_REMOTEAUDIOSOURCE_H_ | 76 #endif // WEBRTC_API_REMOTEAUDIOSOURCE_H_ | 
| OLD | NEW |