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

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

Issue 1547473005: Switch to standard integer types in remoting/host/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
« no previous file with comments | « remoting/host/audio_capturer_win.h ('k') | remoting/host/audio_pump.h » ('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 (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>
11 11
12 #include <stdint.h>
13 #include <stdlib.h>
12 #include <algorithm> 14 #include <algorithm>
13 #include <stdlib.h>
14 15
15 #include "base/logging.h" 16 #include "base/logging.h"
16 17
17 namespace { 18 namespace {
18 const int kChannels = 2; 19 const int kChannels = 2;
19 const int kBytesPerSample = 2; 20 const int kBytesPerSample = 2;
20 const int kBitsPerSample = kBytesPerSample * 8; 21 const int kBitsPerSample = kBytesPerSample * 8;
21 // Conversion factor from 100ns to 1ms. 22 // Conversion factor from 100ns to 1ms.
22 const int k100nsPerMillisecond = 10000; 23 const int k100nsPerMillisecond = 10000;
23 24
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 220
220 BYTE* data; 221 BYTE* data;
221 UINT32 frames; 222 UINT32 frames;
222 DWORD flags; 223 DWORD flags;
223 hr = audio_capture_client_->GetBuffer(&data, &frames, &flags, nullptr, 224 hr = audio_capture_client_->GetBuffer(&data, &frames, &flags, nullptr,
224 nullptr); 225 nullptr);
225 if (FAILED(hr)) 226 if (FAILED(hr))
226 break; 227 break;
227 228
228 if ((flags & AUDCLNT_BUFFERFLAGS_SILENT) == 0 && 229 if ((flags & AUDCLNT_BUFFERFLAGS_SILENT) == 0 &&
229 !silence_detector_.IsSilence( 230 !silence_detector_.IsSilence(reinterpret_cast<const int16_t*>(data),
230 reinterpret_cast<const int16*>(data), frames * kChannels)) { 231 frames * kChannels)) {
231 scoped_ptr<AudioPacket> packet(new AudioPacket()); 232 scoped_ptr<AudioPacket> packet(new AudioPacket());
232 packet->add_data(data, frames * wave_format_ex_->nBlockAlign); 233 packet->add_data(data, frames * wave_format_ex_->nBlockAlign);
233 packet->set_encoding(AudioPacket::ENCODING_RAW); 234 packet->set_encoding(AudioPacket::ENCODING_RAW);
234 packet->set_sampling_rate(sampling_rate_); 235 packet->set_sampling_rate(sampling_rate_);
235 packet->set_bytes_per_sample(AudioPacket::BYTES_PER_SAMPLE_2); 236 packet->set_bytes_per_sample(AudioPacket::BYTES_PER_SAMPLE_2);
236 packet->set_channels(AudioPacket::CHANNELS_STEREO); 237 packet->set_channels(AudioPacket::CHANNELS_STEREO);
237 238
238 callback_.Run(packet.Pass()); 239 callback_.Run(packet.Pass());
239 } 240 }
240 241
(...skipping 17 matching lines...) Expand all
258 259
259 bool AudioCapturer::IsSupported() { 260 bool AudioCapturer::IsSupported() {
260 return true; 261 return true;
261 } 262 }
262 263
263 scoped_ptr<AudioCapturer> AudioCapturer::Create() { 264 scoped_ptr<AudioCapturer> AudioCapturer::Create() {
264 return make_scoped_ptr(new AudioCapturerWin()); 265 return make_scoped_ptr(new AudioCapturerWin());
265 } 266 }
266 267
267 } // namespace remoting 268 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/audio_capturer_win.h ('k') | remoting/host/audio_pump.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698