| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_REMOTE_AUDIO_TRACK_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_REMOTE_AUDIO_TRACK_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_REMOTE_AUDIO_TRACK_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_REMOTE_AUDIO_TRACK_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/threading/thread_checker.h" | 9 #include "base/threading/thread_checker.h" |
| 10 #include "content/renderer/media/media_stream_audio_track.h" | 10 #include "content/renderer/media/media_stream_audio_track.h" |
| 11 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 11 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 class MediaStreamRemoteAudioSource; | 15 class MediaStreamRemoteAudioSource; |
| 16 | 16 |
| 17 // MediaStreamRemoteAudioTrack is a WebRTC specific implementation of an | 17 // MediaStreamRemoteAudioTrack is a WebRTC specific implementation of an |
| 18 // audio track received from a PeerConnection. | 18 // audio track received from a PeerConnection. |
| 19 // TODO(tommi): Chrome shouldn't have to care about remote vs local so | 19 // TODO(tommi): Chrome shouldn't have to care about remote vs local so |
| 20 // we should have a single track implementation that delegates to the | 20 // we should have a single track implementation that delegates to the |
| 21 // sources that do different things depending on the type of source. | 21 // sources that do different things depending on the type of source. |
| 22 class MediaStreamRemoteAudioTrack : public MediaStreamAudioTrack { | 22 class MediaStreamRemoteAudioTrack : public MediaStreamAudioTrack { |
| 23 public: | 23 public: |
| 24 explicit MediaStreamRemoteAudioTrack( | 24 explicit MediaStreamRemoteAudioTrack( |
| 25 const blink::WebMediaStreamSource& source, bool enabled); | 25 const blink::WebMediaStreamSource& source, bool enabled); |
| 26 ~MediaStreamRemoteAudioTrack() override; | 26 ~MediaStreamRemoteAudioTrack() override; |
| 27 | 27 |
| 28 // MediaStreamTrack overrides. |
| 28 void SetEnabled(bool enabled) override; | 29 void SetEnabled(bool enabled) override; |
| 29 void Stop() override; | 30 void Stop() final; |
| 30 | 31 |
| 32 // MediaStreamAudioTrack overrides. |
| 31 void AddSink(MediaStreamAudioSink* sink) override; | 33 void AddSink(MediaStreamAudioSink* sink) override; |
| 32 void RemoveSink(MediaStreamAudioSink* sink) override; | 34 void RemoveSink(MediaStreamAudioSink* sink) override; |
| 33 media::AudioParameters GetOutputFormat() const override; | 35 media::AudioParameters GetOutputFormat() const override; |
| 34 | 36 |
| 35 webrtc::AudioTrackInterface* GetAudioAdapter() override; | 37 webrtc::AudioTrackInterface* GetAudioAdapter() override; |
| 36 | 38 |
| 37 private: | 39 private: |
| 38 MediaStreamRemoteAudioSource* source() const; | 40 MediaStreamRemoteAudioSource* source() const; |
| 39 | 41 |
| 40 blink::WebMediaStreamSource source_; | 42 blink::WebMediaStreamSource source_; |
| 41 bool enabled_; | 43 bool enabled_; |
| 42 }; | 44 }; |
| 43 | 45 |
| 44 // Inheriting from ExtraData directly since MediaStreamAudioSource has | 46 // Inheriting from ExtraData directly since MediaStreamAudioSource has |
| 45 // too much unrelated bloat. | 47 // too much unrelated bloat. |
| 46 // TODO(tommi): MediaStreamAudioSource needs refactoring. | 48 // TODO(tommi): MediaStreamAudioSource needs refactoring. |
| 49 // TODO(miu): On it! ;-) |
| 47 class MediaStreamRemoteAudioSource | 50 class MediaStreamRemoteAudioSource |
| 48 : public blink::WebMediaStreamSource::ExtraData { | 51 : public blink::WebMediaStreamSource::ExtraData { |
| 49 public: | 52 public: |
| 50 explicit MediaStreamRemoteAudioSource( | 53 explicit MediaStreamRemoteAudioSource( |
| 51 const scoped_refptr<webrtc::AudioTrackInterface>& track); | 54 const scoped_refptr<webrtc::AudioTrackInterface>& track); |
| 52 ~MediaStreamRemoteAudioSource() override; | 55 ~MediaStreamRemoteAudioSource() override; |
| 53 | 56 |
| 54 // Controls whether or not the source is included in the main, mixed, audio | 57 // Controls whether or not the source is included in the main, mixed, audio |
| 55 // output from WebRTC as rendered by WebRtcAudioRenderer (media players). | 58 // output from WebRTC as rendered by WebRtcAudioRenderer (media players). |
| 56 void SetEnabledForMixing(bool enabled); | 59 void SetEnabledForMixing(bool enabled); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 75 private: | 78 private: |
| 76 class AudioSink; | 79 class AudioSink; |
| 77 scoped_ptr<AudioSink> sink_; | 80 scoped_ptr<AudioSink> sink_; |
| 78 const scoped_refptr<webrtc::AudioTrackInterface> track_; | 81 const scoped_refptr<webrtc::AudioTrackInterface> track_; |
| 79 base::ThreadChecker thread_checker_; | 82 base::ThreadChecker thread_checker_; |
| 80 }; | 83 }; |
| 81 | 84 |
| 82 } // namespace content | 85 } // namespace content |
| 83 | 86 |
| 84 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_REMOTE_AUDIO_TRACK_H_ | 87 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_REMOTE_AUDIO_TRACK_H_ |
| OLD | NEW |