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

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

Issue 10836017: Piping for audio encoding. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed header guards Created 8 years, 4 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
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 <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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 if (FAILED(hr)) { 272 if (FAILED(hr)) {
273 LOG(ERROR) << "Failed to GetBuffer. Error " << hr; 273 LOG(ERROR) << "Failed to GetBuffer. Error " << hr;
274 return; 274 return;
275 } 275 }
276 276
277 scoped_ptr<AudioPacket> packet = scoped_ptr<AudioPacket>(new AudioPacket()); 277 scoped_ptr<AudioPacket> packet = scoped_ptr<AudioPacket>(new AudioPacket());
278 packet->set_data(data, frames * wave_format_ex_->nBlockAlign); 278 packet->set_data(data, frames * wave_format_ex_->nBlockAlign);
279 packet->set_sampling_rate(sampling_rate_); 279 packet->set_sampling_rate(sampling_rate_);
280 packet->set_bytes_per_sample( 280 packet->set_bytes_per_sample(
281 static_cast<AudioPacket::BytesPerSample>(sizeof(int16))); 281 static_cast<AudioPacket::BytesPerSample>(sizeof(int16)));
282 packet->set_encoding(AudioPacket::ENCODING_RAW);
282 283
283 if (!IsPacketOfSilence(packet.get())) 284 if (!IsPacketOfSilence(packet.get()))
284 callback_.Run(packet.Pass()); 285 callback_.Run(packet.Pass());
285 286
286 hr = audio_capture_client_->ReleaseBuffer(frames); 287 hr = audio_capture_client_->ReleaseBuffer(frames);
287 if (FAILED(hr)) { 288 if (FAILED(hr)) {
288 LOG(ERROR) << "Failed to ReleaseBuffer. Error " << hr; 289 LOG(ERROR) << "Failed to ReleaseBuffer. Error " << hr;
289 return; 290 return;
290 } 291 }
291 } 292 }
(...skipping 13 matching lines...) Expand all
305 return false; 306 return false;
306 } 307 }
307 return true; 308 return true;
308 } 309 }
309 310
310 scoped_ptr<AudioCapturer> AudioCapturer::Create() { 311 scoped_ptr<AudioCapturer> AudioCapturer::Create() {
311 return scoped_ptr<AudioCapturer>(new AudioCapturerWin()); 312 return scoped_ptr<AudioCapturer>(new AudioCapturerWin());
312 } 313 }
313 314
314 } // namespace remoting 315 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698