OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/renderer/media/webrtc_audio_device_impl.h" | 5 #include "content/renderer/media/webrtc_audio_device_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
10 #include "content/renderer/media/audio_hardware.h" | 10 #include "content/renderer/media/audio_hardware.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } | 52 } |
53 | 53 |
54 int32_t WebRtcAudioDeviceImpl::Release() { | 54 int32_t WebRtcAudioDeviceImpl::Release() { |
55 int ret = base::subtle::Barrier_AtomicIncrement(&ref_count_, -1); | 55 int ret = base::subtle::Barrier_AtomicIncrement(&ref_count_, -1); |
56 if (ret == 0) { | 56 if (ret == 0) { |
57 delete this; | 57 delete this; |
58 } | 58 } |
59 return ret; | 59 return ret; |
60 } | 60 } |
61 | 61 |
62 void WebRtcAudioDeviceImpl::Render( | 62 size_t WebRtcAudioDeviceImpl::Render( |
63 const std::vector<float*>& audio_data, | 63 const std::vector<float*>& audio_data, |
64 size_t number_of_frames, | 64 size_t number_of_frames, |
65 size_t audio_delay_milliseconds) { | 65 size_t audio_delay_milliseconds) { |
66 DCHECK_LE(number_of_frames, output_buffer_size_); | 66 DCHECK_LE(number_of_frames, output_buffer_size_); |
67 | 67 |
68 // Store the reported audio delay locally. | 68 // Store the reported audio delay locally. |
69 output_delay_ms_ = audio_delay_milliseconds; | 69 output_delay_ms_ = audio_delay_milliseconds; |
70 | 70 |
71 const int channels = audio_data.size(); | 71 const int channels = audio_data.size(); |
72 DCHECK_LE(channels, output_channels_); | 72 DCHECK_LE(channels, output_channels_); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // with nominal range -1.0 -> +1.0 to match the callback format. | 104 // with nominal range -1.0 -> +1.0 to match the callback format. |
105 for (int channel_index = 0; channel_index < channels; ++channel_index) { | 105 for (int channel_index = 0; channel_index < channels; ++channel_index) { |
106 media::DeinterleaveAudioChannel( | 106 media::DeinterleaveAudioChannel( |
107 output_buffer_.get(), | 107 output_buffer_.get(), |
108 audio_data[channel_index], | 108 audio_data[channel_index], |
109 channels, | 109 channels, |
110 channel_index, | 110 channel_index, |
111 bytes_per_sample_, | 111 bytes_per_sample_, |
112 number_of_frames); | 112 number_of_frames); |
113 } | 113 } |
| 114 return number_of_frames; |
114 } | 115 } |
115 | 116 |
116 void WebRtcAudioDeviceImpl::Capture( | 117 void WebRtcAudioDeviceImpl::Capture( |
117 const std::vector<float*>& audio_data, | 118 const std::vector<float*>& audio_data, |
118 size_t number_of_frames, | 119 size_t number_of_frames, |
119 size_t audio_delay_milliseconds) { | 120 size_t audio_delay_milliseconds) { |
120 DCHECK_LE(number_of_frames, input_buffer_size_); | 121 DCHECK_LE(number_of_frames, input_buffer_size_); |
121 | 122 |
122 // Store the reported audio delay locally. | 123 // Store the reported audio delay locally. |
123 input_delay_ms_ = audio_delay_milliseconds; | 124 input_delay_ms_ = audio_delay_milliseconds; |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 } | 967 } |
967 | 968 |
968 int32_t WebRtcAudioDeviceImpl::GetLoudspeakerStatus(bool* enabled) const { | 969 int32_t WebRtcAudioDeviceImpl::GetLoudspeakerStatus(bool* enabled) const { |
969 NOTIMPLEMENTED(); | 970 NOTIMPLEMENTED(); |
970 return -1; | 971 return -1; |
971 } | 972 } |
972 | 973 |
973 void WebRtcAudioDeviceImpl::SetSessionId(int session_id) { | 974 void WebRtcAudioDeviceImpl::SetSessionId(int session_id) { |
974 session_id_ = session_id; | 975 session_id_ = session_id; |
975 } | 976 } |
OLD | NEW |