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

Side by Side Diff: trunk/src/content/renderer/media/media_stream_audio_processor.h

Issue 146923002: Revert 246894 "Wire up AGC to the MediaStreamAudioProcessor." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | trunk/src/content/renderer/media/media_stream_audio_processor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_MEDIA_STREAM_AUDIO_PROCESSOR_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_ 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_
7 7
8 #include "base/atomicops.h" 8 #include "base/atomicops.h"
9 #include "base/synchronization/lock.h" 9 #include "base/synchronization/lock.h"
10 #include "base/threading/thread_checker.h" 10 #include "base/threading/thread_checker.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 int sample_rate, 56 int sample_rate,
57 int number_of_channels, 57 int number_of_channels,
58 int number_of_frames, 58 int number_of_frames,
59 base::TimeDelta render_delay); 59 base::TimeDelta render_delay);
60 60
61 // Processes a block of 10 ms data from the internal FIFO and outputs it via 61 // Processes a block of 10 ms data from the internal FIFO and outputs it via
62 // |out|. |out| is the address of the pointer that will be pointed to 62 // |out|. |out| is the address of the pointer that will be pointed to
63 // the post-processed data if the method is returning a true. The lifetime 63 // the post-processed data if the method is returning a true. The lifetime
64 // of the data represeted by |out| is guaranteed to outlive the method call. 64 // of the data represeted by |out| is guaranteed to outlive the method call.
65 // That also says *|out| won't change until this method is called again. 65 // That also says *|out| won't change until this method is called again.
66 // |new_volume| receives the new microphone volume from the AGC.
67 // The new microphoen volume range is [0, 255], and the value will be 0 if
68 // the microphone volume should not be adjusted.
69 // Returns true if the internal FIFO has at least 10 ms data for processing, 66 // Returns true if the internal FIFO has at least 10 ms data for processing,
70 // otherwise false. 67 // otherwise false.
71 // |capture_delay|, |volume| and |key_pressed| will be passed to 68 // |capture_delay|, |volume| and |key_pressed| will be passed to
72 // webrtc::AudioProcessing to help processing the data. 69 // webrtc::AudioProcessing to help processing the data.
73 // Called on the capture audio thread. 70 // Called on the capture audio thread.
74 bool ProcessAndConsumeData(base::TimeDelta capture_delay, 71 bool ProcessAndConsumeData(base::TimeDelta capture_delay,
75 int volume, 72 int volume,
76 bool key_pressed, 73 bool key_pressed,
77 int* new_volume,
78 int16** out); 74 int16** out);
79 75
80 76
81 // The audio format of the input to the processor. 77 // The audio format of the input to the processor.
82 const media::AudioParameters& InputFormat() const; 78 const media::AudioParameters& InputFormat() const;
83 79
84 // The audio format of the output from the processor. 80 // The audio format of the output from the processor.
85 const media::AudioParameters& OutputFormat() const; 81 const media::AudioParameters& OutputFormat() const;
86 82
87 // Accessor to check if the audio processing is enabled or not. 83 // Accessor to check if the audio processing is enabled or not.
88 bool has_audio_processing() const { return audio_processing_ != NULL; } 84 bool has_audio_processing() const { return audio_processing_ != NULL; }
89 85
90 protected: 86 protected:
91 friend class base::RefCountedThreadSafe<MediaStreamAudioProcessor>; 87 friend class base::RefCountedThreadSafe<MediaStreamAudioProcessor>;
92 virtual ~MediaStreamAudioProcessor(); 88 virtual ~MediaStreamAudioProcessor();
93 89
94 private: 90 private:
95 friend class MediaStreamAudioProcessorTest;
96
97 class MediaStreamAudioConverter; 91 class MediaStreamAudioConverter;
98 92
99 // Helper to initialize the WebRtc AudioProcessing. 93 // Helper to initialize the WebRtc AudioProcessing.
100 void InitializeAudioProcessingModule( 94 void InitializeAudioProcessingModule(
101 const blink::WebMediaConstraints& constraints, int effects); 95 const blink::WebMediaConstraints& constraints, int effects);
102 96
103 // Helper to initialize the capture converter. 97 // Helper to initialize the capture converter.
104 void InitializeCaptureConverter(const media::AudioParameters& source_params); 98 void InitializeCaptureConverter(const media::AudioParameters& source_params);
105 99
106 // Helper to initialize the render converter. 100 // Helper to initialize the render converter.
107 void InitializeRenderConverterIfNeeded(int sample_rate, 101 void InitializeRenderConverterIfNeeded(int sample_rate,
108 int number_of_channels, 102 int number_of_channels,
109 int frames_per_buffer); 103 int frames_per_buffer);
110 104
111 // Called by ProcessAndConsumeData(). 105 // Called by ProcessAndConsumeData().
112 // Returns the new microphone volume in the range of |0, 255]. 106 void ProcessData(webrtc::AudioFrame* audio_frame,
113 // When the volume does not need to be updated, it returns 0. 107 base::TimeDelta capture_delay,
114 int ProcessData(webrtc::AudioFrame* audio_frame, 108 int volume,
115 base::TimeDelta capture_delay, 109 bool key_pressed);
116 int volume,
117 bool key_pressed);
118 110
119 // Called when the processor is going away. 111 // Called when the processor is going away.
120 void StopAudioProcessing(); 112 void StopAudioProcessing();
121 113
122 // Cached value for the render delay latency. This member is accessed by 114 // Cached value for the render delay latency. This member is accessed by
123 // both the capture audio thread and the render audio thread. 115 // both the capture audio thread and the render audio thread.
124 base::subtle::Atomic32 render_delay_ms_; 116 base::subtle::Atomic32 render_delay_ms_;
125 117
126 // webrtc::AudioProcessing module which does AEC, AGC, NS, HighPass filter, 118 // webrtc::AudioProcessing module which does AEC, AGC, NS, HighPass filter,
127 // ..etc. 119 // ..etc.
(...skipping 16 matching lines...) Expand all
144 scoped_ptr<media::AudioBus> render_data_bus_; 136 scoped_ptr<media::AudioBus> render_data_bus_;
145 137
146 // Used to DCHECK that some methods are called on the main render thread. 138 // Used to DCHECK that some methods are called on the main render thread.
147 base::ThreadChecker main_thread_checker_; 139 base::ThreadChecker main_thread_checker_;
148 140
149 // Used to DCHECK that some methods are called on the capture audio thread. 141 // Used to DCHECK that some methods are called on the capture audio thread.
150 base::ThreadChecker capture_thread_checker_; 142 base::ThreadChecker capture_thread_checker_;
151 143
152 // Used to DCHECK that PushRenderData() is called on the render audio thread. 144 // Used to DCHECK that PushRenderData() is called on the render audio thread.
153 base::ThreadChecker render_thread_checker_; 145 base::ThreadChecker render_thread_checker_;
154
155 // Flag to enable the stereo channels mirroring.
156 bool audio_mirroring_;
157 }; 146 };
158 147
159 } // namespace content 148 } // namespace content
160 149
161 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_ 150 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_
OLDNEW
« no previous file with comments | « no previous file | trunk/src/content/renderer/media/media_stream_audio_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698