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

Side by Side Diff: content/renderer/media/webrtc_local_audio_track.h

Issue 23171026: Feed audio constraints over to WebRtcLocalAudioTrack (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address comments Created 7 years, 3 months 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_LOCAL_AUDIO_TRACK_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_TRACK_H_
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_TRACK_H_ 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_TRACK_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 10
11 #include "base/synchronization/lock.h" 11 #include "base/synchronization/lock.h"
12 #include "base/threading/thread_checker.h" 12 #include "base/threading/thread_checker.h"
13 #include "content/renderer/media/webrtc_audio_device_impl.h" 13 #include "content/renderer/media/webrtc_audio_device_impl.h"
14 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface .h"
14 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" 15 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h"
15 #include "third_party/libjingle/source/talk/app/webrtc/mediastreamtrack.h" 16 #include "third_party/libjingle/source/talk/app/webrtc/mediastreamtrack.h"
16 #include "third_party/libjingle/source/talk/media/base/audiorenderer.h" 17 #include "third_party/libjingle/source/talk/media/base/audiorenderer.h"
17 18
18 namespace cricket { 19 namespace cricket {
19 class AudioRenderer; 20 class AudioRenderer;
20 } 21 }
21 22
22 namespace content { 23 namespace content {
23 24
24 class WebRtcAudioCapturer; 25 class WebRtcAudioCapturer;
25 class WebRtcAudioCapturerSinkOwner; 26 class WebRtcAudioCapturerSinkOwner;
26 27
27 // A WebRtcLocalAudioTrack instance contains the implementations of 28 // A WebRtcLocalAudioTrack instance contains the implementations of
28 // MediaStreamTrack and WebRtcAudioCapturerSink. 29 // MediaStreamTrack and WebRtcAudioCapturerSink.
29 // When an instance is created, it will register itself as a track to the 30 // When an instance is created, it will register itself as a track to the
30 // WebRtcAudioCapturer to get the captured data, and forward the data to 31 // WebRtcAudioCapturer to get the captured data, and forward the data to
31 // its |sinks_|. The data flow can be stopped by disabling the audio track. 32 // its |sinks_|. The data flow can be stopped by disabling the audio track.
32 class CONTENT_EXPORT WebRtcLocalAudioTrack 33 class CONTENT_EXPORT WebRtcLocalAudioTrack
33 : NON_EXPORTED_BASE(public cricket::AudioRenderer), 34 : NON_EXPORTED_BASE(public cricket::AudioRenderer),
34 NON_EXPORTED_BASE( 35 NON_EXPORTED_BASE(
35 public webrtc::MediaStreamTrack<webrtc::AudioTrackInterface>) { 36 public webrtc::MediaStreamTrack<webrtc::AudioTrackInterface>) {
36 public: 37 public:
37 static scoped_refptr<WebRtcLocalAudioTrack> Create( 38 static scoped_refptr<WebRtcLocalAudioTrack> Create(
38 const std::string& id, 39 const std::string& id,
39 const scoped_refptr<WebRtcAudioCapturer>& capturer, 40 const scoped_refptr<WebRtcAudioCapturer>& capturer,
40 webrtc::AudioSourceInterface* stream_source); 41 webrtc::AudioSourceInterface* stream_source,
42 const webrtc::MediaConstraintsInterface* constraints);
41 43
42 // Add a sink to the track. This function will trigger a SetCaptureFormat() 44 // Add a sink to the track. This function will trigger a SetCaptureFormat()
43 // call on the |sink|. 45 // call on the |sink|.
44 // Called on the main render thread. 46 // Called on the main render thread.
45 void AddSink(WebRtcAudioCapturerSink* sink); 47 void AddSink(WebRtcAudioCapturerSink* sink);
46 48
47 // Remove a sink from the track. 49 // Remove a sink from the track.
48 // Called on the main render thread. 50 // Called on the main render thread.
49 void RemoveSink(WebRtcAudioCapturerSink* sink); 51 void RemoveSink(WebRtcAudioCapturerSink* sink);
50 52
(...skipping 14 matching lines...) Expand all
65 bool key_pressed); 67 bool key_pressed);
66 68
67 // Method called by the capturer to set the audio parameters used by source 69 // Method called by the capturer to set the audio parameters used by source
68 // of the capture data.. 70 // of the capture data..
69 // Can be called on different user threads. 71 // Can be called on different user threads.
70 void SetCaptureFormat(const media::AudioParameters& params); 72 void SetCaptureFormat(const media::AudioParameters& params);
71 73
72 protected: 74 protected:
73 WebRtcLocalAudioTrack(const std::string& label, 75 WebRtcLocalAudioTrack(const std::string& label,
74 const scoped_refptr<WebRtcAudioCapturer>& capturer, 76 const scoped_refptr<WebRtcAudioCapturer>& capturer,
75 webrtc::AudioSourceInterface* track_source); 77 webrtc::AudioSourceInterface* track_source,
78 const webrtc::MediaConstraintsInterface* constraints);
76 virtual ~WebRtcLocalAudioTrack(); 79 virtual ~WebRtcLocalAudioTrack();
77 80
78 private: 81 private:
79 typedef std::list<scoped_refptr<WebRtcAudioCapturerSinkOwner> > SinkList; 82 typedef std::list<scoped_refptr<WebRtcAudioCapturerSinkOwner> > SinkList;
80 83
81 // cricket::AudioCapturer implementation. 84 // cricket::AudioCapturer implementation.
82 virtual void AddChannel(int channel_id) OVERRIDE; 85 virtual void AddChannel(int channel_id) OVERRIDE;
83 virtual void RemoveChannel(int channel_id) OVERRIDE; 86 virtual void RemoveChannel(int channel_id) OVERRIDE;
84 87
85 // webrtc::AudioTrackInterface implementation. 88 // webrtc::AudioTrackInterface implementation.
(...skipping 27 matching lines...) Expand all
113 std::vector<int> voe_channels_; 116 std::vector<int> voe_channels_;
114 117
115 bool need_audio_processing_; 118 bool need_audio_processing_;
116 119
117 DISALLOW_COPY_AND_ASSIGN(WebRtcLocalAudioTrack); 120 DISALLOW_COPY_AND_ASSIGN(WebRtcLocalAudioTrack);
118 }; 121 };
119 122
120 } // namespace content 123 } // namespace content
121 124
122 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_TRACK_H_ 125 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_TRACK_H_
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc_audio_device_unittest.cc ('k') | content/renderer/media/webrtc_local_audio_track.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698