OLD | NEW |
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 <windows.h> | 5 #include <windows.h> |
6 #include <audioclient.h> | 6 #include <audioclient.h> |
7 #include <avrt.h> | 7 #include <avrt.h> |
8 #include <mmdeviceapi.h> | 8 #include <mmdeviceapi.h> |
9 #include <mmreg.h> | 9 #include <mmreg.h> |
10 #include <mmsystem.h> | 10 #include <mmsystem.h> |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 &data, &frames, &flags, NULL, NULL); | 261 &data, &frames, &flags, NULL, NULL); |
262 if (FAILED(hr)) { | 262 if (FAILED(hr)) { |
263 LOG(ERROR) << "Failed to GetBuffer. Error " << hr; | 263 LOG(ERROR) << "Failed to GetBuffer. Error " << hr; |
264 return; | 264 return; |
265 } | 265 } |
266 | 266 |
267 scoped_ptr<AudioPacket> packet = scoped_ptr<AudioPacket>(new AudioPacket()); | 267 scoped_ptr<AudioPacket> packet = scoped_ptr<AudioPacket>(new AudioPacket()); |
268 packet->set_data(data, frames * wave_format_ex_->nBlockAlign); | 268 packet->set_data(data, frames * wave_format_ex_->nBlockAlign); |
269 packet->set_sampling_rate(sampling_rate_); | 269 packet->set_sampling_rate(sampling_rate_); |
270 | 270 |
271 callback_.Run(packet.Pass()); | 271 if (!AudioCapturer::IsPacketOfSilence(packet.get())) |
| 272 callback_.Run(packet.Pass()); |
272 | 273 |
273 hr = audio_capture_client_->ReleaseBuffer(frames); | 274 hr = audio_capture_client_->ReleaseBuffer(frames); |
274 if (FAILED(hr)) { | 275 if (FAILED(hr)) { |
275 LOG(ERROR) << "Failed to ReleaseBuffer. Error " << hr; | 276 LOG(ERROR) << "Failed to ReleaseBuffer. Error " << hr; |
276 return; | 277 return; |
277 } | 278 } |
278 } | 279 } |
279 } | 280 } |
280 | 281 |
281 scoped_ptr<AudioCapturer> AudioCapturer::Create() { | 282 scoped_ptr<AudioCapturer> AudioCapturer::Create() { |
282 return scoped_ptr<AudioCapturer>(new AudioCapturerWin()); | 283 return scoped_ptr<AudioCapturer>(new AudioCapturerWin()); |
283 } | 284 } |
284 | 285 |
285 } // namespace remoting | 286 } // namespace remoting |
OLD | NEW |