Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: talk/app/webrtc/remoteaudiosource.h

Issue 1505253004: Support for remote audio into tracks (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Address comments Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 11 matching lines...) Expand all
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 #ifndef TALK_APP_WEBRTC_REMOTEAUDIOSOURCE_H_ 28 #ifndef TALK_APP_WEBRTC_REMOTEAUDIOSOURCE_H_
29 #define TALK_APP_WEBRTC_REMOTEAUDIOSOURCE_H_ 29 #define TALK_APP_WEBRTC_REMOTEAUDIOSOURCE_H_
30 30
31 #include <list> 31 #include <list>
32 #include <string>
32 33
33 #include "talk/app/webrtc/mediastreaminterface.h" 34 #include "talk/app/webrtc/mediastreaminterface.h"
34 #include "talk/app/webrtc/notifier.h" 35 #include "talk/app/webrtc/notifier.h"
36 #include "talk/media/base/audiorenderer.h"
37 #include "webrtc/audio/audio_sink.h"
38 #include "webrtc/base/criticalsection.h"
39
40 namespace rtc {
41 struct Message;
42 class Thread;
43 } // namespace rtc
35 44
36 namespace webrtc { 45 namespace webrtc {
37 46
38 using webrtc::AudioSourceInterface; 47 class AudioProviderInterface;
39 48
40 // This class implements the audio source used by the remote audio track. 49 // This class implements the audio source used by the remote audio track.
41 class RemoteAudioSource : public Notifier<AudioSourceInterface> { 50 class RemoteAudioSource : public Notifier<AudioSourceInterface> {
42 public: 51 public:
43 // Creates an instance of RemoteAudioSource. 52 // Creates an instance of RemoteAudioSource.
44 static rtc::scoped_refptr<RemoteAudioSource> Create(); 53 static rtc::scoped_refptr<RemoteAudioSource> Create(
54 uint32_t ssrc,
55 AudioProviderInterface* provider);
56
57 // MediaSourceInterface implementation.
58 MediaSourceInterface::SourceState state() const override;
59
60 void AddSink(AudioTrackSinkInterface* sink);
61 void RemoveSink(AudioTrackSinkInterface* sink);
45 62
46 protected: 63 protected:
47 RemoteAudioSource(); 64 RemoteAudioSource();
48 virtual ~RemoteAudioSource(); 65 ~RemoteAudioSource() override;
66
67 // Post construction initialize where we can do things like save a reference
68 // to ourselves (need to be fully constructed).
69 void Initialize(uint32_t ssrc, AudioProviderInterface* provider);
49 70
50 private: 71 private:
51 typedef std::list<AudioObserver*> AudioObserverList; 72 typedef std::list<AudioObserver*> AudioObserverList;
52 73
53 // MediaSourceInterface implementation.
54 MediaSourceInterface::SourceState state() const override;
55
56 // AudioSourceInterface implementation. 74 // AudioSourceInterface implementation.
57 void SetVolume(double volume) override; 75 void SetVolume(double volume) override;
58 void RegisterAudioObserver(AudioObserver* observer) override; 76 void RegisterAudioObserver(AudioObserver* observer) override;
59 void UnregisterAudioObserver(AudioObserver* observer) override; 77 void UnregisterAudioObserver(AudioObserver* observer) override;
60 78
79 class Sink;
80 void OnData(const AudioSinkInterface::Data& audio);
81 void OnAudioProviderGone();
82
83 class MessageHandler;
84 void OnMessage(rtc::Message* msg);
85
61 AudioObserverList audio_observers_; 86 AudioObserverList audio_observers_;
87 rtc::CriticalSection sink_lock_;
88 std::list<AudioTrackSinkInterface*> sinks_;
89 rtc::Thread* const main_thread_;
90 SourceState state_;
62 }; 91 };
63 92
64 } // namespace webrtc 93 } // namespace webrtc
65 94
66 #endif // TALK_APP_WEBRTC_REMOTEAUDIOSOURCE_H_ 95 #endif // TALK_APP_WEBRTC_REMOTEAUDIOSOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698