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

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

Issue 1549493004: Use std::move() instead of .Pass() in remoting/host (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_not_pass
Patch Set: Created 5 years 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 (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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 if ((flags & AUDCLNT_BUFFERFLAGS_SILENT) == 0 && 228 if ((flags & AUDCLNT_BUFFERFLAGS_SILENT) == 0 &&
229 !silence_detector_.IsSilence( 229 !silence_detector_.IsSilence(
230 reinterpret_cast<const int16*>(data), frames * kChannels)) { 230 reinterpret_cast<const int16*>(data), frames * kChannels)) {
231 scoped_ptr<AudioPacket> packet(new AudioPacket()); 231 scoped_ptr<AudioPacket> packet(new AudioPacket());
232 packet->add_data(data, frames * wave_format_ex_->nBlockAlign); 232 packet->add_data(data, frames * wave_format_ex_->nBlockAlign);
233 packet->set_encoding(AudioPacket::ENCODING_RAW); 233 packet->set_encoding(AudioPacket::ENCODING_RAW);
234 packet->set_sampling_rate(sampling_rate_); 234 packet->set_sampling_rate(sampling_rate_);
235 packet->set_bytes_per_sample(AudioPacket::BYTES_PER_SAMPLE_2); 235 packet->set_bytes_per_sample(AudioPacket::BYTES_PER_SAMPLE_2);
236 packet->set_channels(AudioPacket::CHANNELS_STEREO); 236 packet->set_channels(AudioPacket::CHANNELS_STEREO);
237 237
238 callback_.Run(packet.Pass()); 238 callback_.Run(std::move(packet));
239 } 239 }
240 240
241 hr = audio_capture_client_->ReleaseBuffer(frames); 241 hr = audio_capture_client_->ReleaseBuffer(frames);
242 if (FAILED(hr)) 242 if (FAILED(hr))
243 break; 243 break;
244 } 244 }
245 245
246 // There is nothing to capture if the audio endpoint device has been unplugged 246 // There is nothing to capture if the audio endpoint device has been unplugged
247 // or disabled. 247 // or disabled.
248 if (hr == AUDCLNT_E_DEVICE_INVALIDATED) 248 if (hr == AUDCLNT_E_DEVICE_INVALIDATED)
249 return; 249 return;
250 250
251 // Avoid reporting the same error multiple times. 251 // Avoid reporting the same error multiple times.
252 if (FAILED(hr) && hr != last_capture_error_) { 252 if (FAILED(hr) && hr != last_capture_error_) {
253 last_capture_error_ = hr; 253 last_capture_error_ = hr;
254 LOG(ERROR) << "Failed to capture an audio packet: 0x" 254 LOG(ERROR) << "Failed to capture an audio packet: 0x"
255 << std::hex << hr << std::dec << "."; 255 << std::hex << hr << std::dec << ".";
256 } 256 }
257 } 257 }
258 258
259 bool AudioCapturer::IsSupported() { 259 bool AudioCapturer::IsSupported() {
260 return true; 260 return true;
261 } 261 }
262 262
263 scoped_ptr<AudioCapturer> AudioCapturer::Create() { 263 scoped_ptr<AudioCapturer> AudioCapturer::Create() {
264 return make_scoped_ptr(new AudioCapturerWin()); 264 return make_scoped_ptr(new AudioCapturerWin());
265 } 265 }
266 266
267 } // namespace remoting 267 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698