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

Side by Side Diff: remoting/host/audio_capturer_win.cc

Issue 23456019: Fix Windows audio capturer to handle AUDCLNT_BUFFERFLAGS_SILENT flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "remoting/host/audio_capturer_win.h" 5 #include "remoting/host/audio_capturer_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <avrt.h> 8 #include <avrt.h>
9 #include <mmreg.h> 9 #include <mmreg.h>
10 #include <mmsystem.h> 10 #include <mmsystem.h>
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 return; 235 return;
236 } 236 }
237 237
238 BYTE* data; 238 BYTE* data;
239 UINT32 frames; 239 UINT32 frames;
240 DWORD flags; 240 DWORD flags;
241 hr = audio_capture_client_->GetBuffer(&data, &frames, &flags, NULL, NULL); 241 hr = audio_capture_client_->GetBuffer(&data, &frames, &flags, NULL, NULL);
242 if (FAILED(hr)) 242 if (FAILED(hr))
243 break; 243 break;
244 244
245 if (!silence_detector_.IsSilence( 245 if ((flags & AUDCLNT_BUFFERFLAGS_SILENT) == 0 &&
246 !silence_detector_.IsSilence(
246 reinterpret_cast<const int16*>(data), frames * kChannels)) { 247 reinterpret_cast<const int16*>(data), frames * kChannels)) {
247 scoped_ptr<AudioPacket> packet = 248 scoped_ptr<AudioPacket> packet =
248 scoped_ptr<AudioPacket>(new AudioPacket()); 249 scoped_ptr<AudioPacket>(new AudioPacket());
249 packet->add_data(data, frames * wave_format_ex_->nBlockAlign); 250 packet->add_data(data, frames * wave_format_ex_->nBlockAlign);
250 packet->set_encoding(AudioPacket::ENCODING_RAW); 251 packet->set_encoding(AudioPacket::ENCODING_RAW);
251 packet->set_sampling_rate(sampling_rate_); 252 packet->set_sampling_rate(sampling_rate_);
252 packet->set_bytes_per_sample(AudioPacket::BYTES_PER_SAMPLE_2); 253 packet->set_bytes_per_sample(AudioPacket::BYTES_PER_SAMPLE_2);
253 packet->set_channels(AudioPacket::CHANNELS_STEREO); 254 packet->set_channels(AudioPacket::CHANNELS_STEREO);
254 255
255 callback_.Run(packet.Pass()); 256 callback_.Run(packet.Pass());
(...skipping 19 matching lines...) Expand all
275 276
276 bool AudioCapturer::IsSupported() { 277 bool AudioCapturer::IsSupported() {
277 return true; 278 return true;
278 } 279 }
279 280
280 scoped_ptr<AudioCapturer> AudioCapturer::Create() { 281 scoped_ptr<AudioCapturer> AudioCapturer::Create() {
281 return scoped_ptr<AudioCapturer>(new AudioCapturerWin()); 282 return scoped_ptr<AudioCapturer>(new AudioCapturerWin());
282 } 283 }
283 284
284 } // namespace remoting 285 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698