| 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 "remoting/host/audio_capturer_win.h" | 5 #include "remoting/host/audio_capturer_win.h" |
| 6 | 6 |
| 7 #include <avrt.h> | 7 #include <avrt.h> |
| 8 #include <mmreg.h> | 8 #include <mmreg.h> |
| 9 #include <mmsystem.h> | 9 #include <mmsystem.h> |
| 10 #include <objbase.h> | 10 #include <objbase.h> |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 break; | 267 break; |
| 268 | 268 |
| 269 if (volume_filter_.Apply(reinterpret_cast<int16_t*>(data), frames)) { | 269 if (volume_filter_.Apply(reinterpret_cast<int16_t*>(data), frames)) { |
| 270 std::unique_ptr<AudioPacket> packet(new AudioPacket()); | 270 std::unique_ptr<AudioPacket> packet(new AudioPacket()); |
| 271 packet->add_data(data, frames * wave_format_ex_->nBlockAlign); | 271 packet->add_data(data, frames * wave_format_ex_->nBlockAlign); |
| 272 packet->set_encoding(AudioPacket::ENCODING_RAW); | 272 packet->set_encoding(AudioPacket::ENCODING_RAW); |
| 273 packet->set_sampling_rate(sampling_rate_); | 273 packet->set_sampling_rate(sampling_rate_); |
| 274 packet->set_bytes_per_sample(AudioPacket::BYTES_PER_SAMPLE_2); | 274 packet->set_bytes_per_sample(AudioPacket::BYTES_PER_SAMPLE_2); |
| 275 // Only the count of channels is taken into account now, we should also | 275 // Only the count of channels is taken into account now, we should also |
| 276 // consider dwChannelMask. | 276 // consider dwChannelMask. |
| 277 // TODO(zijiehe): Support also layouts. | 277 // TODO(zijiehe): Convert dwChannelMask to layout and pass it to |
| 278 // AudioPump. So the stream can be downmixed properly with both number and |
| 279 // layouts of speakers. |
| 278 packet->set_channels(static_cast<AudioPacket::Channels>( | 280 packet->set_channels(static_cast<AudioPacket::Channels>( |
| 279 wave_format_ex_->nChannels)); | 281 wave_format_ex_->nChannels)); |
| 280 | 282 |
| 281 callback_.Run(std::move(packet)); | 283 callback_.Run(std::move(packet)); |
| 282 } | 284 } |
| 283 | 285 |
| 284 hr = audio_capture_client_->ReleaseBuffer(frames); | 286 hr = audio_capture_client_->ReleaseBuffer(frames); |
| 285 if (FAILED(hr)) | 287 if (FAILED(hr)) |
| 286 break; | 288 break; |
| 287 } | 289 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 301 | 303 |
| 302 bool AudioCapturer::IsSupported() { | 304 bool AudioCapturer::IsSupported() { |
| 303 return true; | 305 return true; |
| 304 } | 306 } |
| 305 | 307 |
| 306 std::unique_ptr<AudioCapturer> AudioCapturer::Create() { | 308 std::unique_ptr<AudioCapturer> AudioCapturer::Create() { |
| 307 return base::WrapUnique(new AudioCapturerWin()); | 309 return base::WrapUnique(new AudioCapturerWin()); |
| 308 } | 310 } |
| 309 | 311 |
| 310 } // namespace remoting | 312 } // namespace remoting |
| OLD | NEW |