| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 "VoEVideoSyncImpl::VoEVideoSyncImpl() - ctor"); | 38 "VoEVideoSyncImpl::VoEVideoSyncImpl() - ctor"); |
| 39 } | 39 } |
| 40 | 40 |
| 41 VoEVideoSyncImpl::~VoEVideoSyncImpl() { | 41 VoEVideoSyncImpl::~VoEVideoSyncImpl() { |
| 42 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), | 42 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 43 "VoEVideoSyncImpl::~VoEVideoSyncImpl() - dtor"); | 43 "VoEVideoSyncImpl::~VoEVideoSyncImpl() - dtor"); |
| 44 } | 44 } |
| 45 | 45 |
| 46 int VoEVideoSyncImpl::GetPlayoutTimestamp(int channel, | 46 int VoEVideoSyncImpl::GetPlayoutTimestamp(int channel, |
| 47 unsigned int& timestamp) { | 47 unsigned int& timestamp) { |
| 48 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | |
| 49 "GetPlayoutTimestamp(channel=%d, timestamp=?)", channel); | |
| 50 | |
| 51 if (!_shared->statistics().Initialized()) { | 48 if (!_shared->statistics().Initialized()) { |
| 52 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 49 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
| 53 return -1; | 50 return -1; |
| 54 } | 51 } |
| 55 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 52 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 56 voe::Channel* channel_ptr = ch.channel(); | 53 voe::Channel* channel_ptr = ch.channel(); |
| 57 if (channel_ptr == NULL) { | 54 if (channel_ptr == NULL) { |
| 58 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 55 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
| 59 "GetPlayoutTimestamp() failed to locate channel"); | 56 "GetPlayoutTimestamp() failed to locate channel"); |
| 60 return -1; | 57 return -1; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 131 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
| 135 "SetInitialPlayoutDelay() failed to locate channel"); | 132 "SetInitialPlayoutDelay() failed to locate channel"); |
| 136 return -1; | 133 return -1; |
| 137 } | 134 } |
| 138 return channelPtr->SetInitialPlayoutDelay(delay_ms); | 135 return channelPtr->SetInitialPlayoutDelay(delay_ms); |
| 139 } | 136 } |
| 140 | 137 |
| 141 int VoEVideoSyncImpl::GetDelayEstimate(int channel, | 138 int VoEVideoSyncImpl::GetDelayEstimate(int channel, |
| 142 int* jitter_buffer_delay_ms, | 139 int* jitter_buffer_delay_ms, |
| 143 int* playout_buffer_delay_ms) { | 140 int* playout_buffer_delay_ms) { |
| 144 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | |
| 145 "GetDelayEstimate(channel=%d, delayMs=?)", channel); | |
| 146 | |
| 147 if (!_shared->statistics().Initialized()) { | 141 if (!_shared->statistics().Initialized()) { |
| 148 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 142 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
| 149 return -1; | 143 return -1; |
| 150 } | 144 } |
| 151 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 145 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 152 voe::Channel* channelPtr = ch.channel(); | 146 voe::Channel* channelPtr = ch.channel(); |
| 153 if (channelPtr == NULL) { | 147 if (channelPtr == NULL) { |
| 154 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 148 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
| 155 "GetDelayEstimate() failed to locate channel"); | 149 "GetDelayEstimate() failed to locate channel"); |
| 156 return -1; | 150 return -1; |
| 157 } | 151 } |
| 158 if (!channelPtr->GetDelayEstimate(jitter_buffer_delay_ms, | 152 if (!channelPtr->GetDelayEstimate(jitter_buffer_delay_ms, |
| 159 playout_buffer_delay_ms)) { | 153 playout_buffer_delay_ms)) { |
| 160 return -1; | 154 return -1; |
| 161 } | 155 } |
| 162 return 0; | 156 return 0; |
| 163 } | 157 } |
| 164 | 158 |
| 165 int VoEVideoSyncImpl::GetPlayoutBufferSize(int& bufferMs) { | 159 int VoEVideoSyncImpl::GetPlayoutBufferSize(int& bufferMs) { |
| 166 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | |
| 167 "GetPlayoutBufferSize(bufferMs=?)"); | |
| 168 | |
| 169 if (!_shared->statistics().Initialized()) { | 160 if (!_shared->statistics().Initialized()) { |
| 170 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 161 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
| 171 return -1; | 162 return -1; |
| 172 } | 163 } |
| 173 AudioDeviceModule::BufferType type(AudioDeviceModule::kFixedBufferSize); | 164 AudioDeviceModule::BufferType type(AudioDeviceModule::kFixedBufferSize); |
| 174 uint16_t sizeMS(0); | 165 uint16_t sizeMS(0); |
| 175 if (_shared->audio_device()->PlayoutBuffer(&type, &sizeMS) != 0) { | 166 if (_shared->audio_device()->PlayoutBuffer(&type, &sizeMS) != 0) { |
| 176 _shared->SetLastError(VE_AUDIO_DEVICE_MODULE_ERROR, kTraceError, | 167 _shared->SetLastError(VE_AUDIO_DEVICE_MODULE_ERROR, kTraceError, |
| 177 "GetPlayoutBufferSize() failed to read buffer size"); | 168 "GetPlayoutBufferSize() failed to read buffer size"); |
| 178 return -1; | 169 return -1; |
| 179 } | 170 } |
| 180 bufferMs = sizeMS; | 171 bufferMs = sizeMS; |
| 181 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_shared->instance_id(), -1), | |
| 182 "GetPlayoutBufferSize() => bufferMs=%d", bufferMs); | |
| 183 return 0; | 172 return 0; |
| 184 } | 173 } |
| 185 | 174 |
| 186 int VoEVideoSyncImpl::GetRtpRtcp(int channel, | 175 int VoEVideoSyncImpl::GetRtpRtcp(int channel, |
| 187 RtpRtcp** rtpRtcpModule, | 176 RtpRtcp** rtpRtcpModule, |
| 188 RtpReceiver** rtp_receiver) { | 177 RtpReceiver** rtp_receiver) { |
| 189 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | |
| 190 "GetRtpRtcp(channel=%i)", channel); | |
| 191 | |
| 192 if (!_shared->statistics().Initialized()) { | 178 if (!_shared->statistics().Initialized()) { |
| 193 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 179 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
| 194 return -1; | 180 return -1; |
| 195 } | 181 } |
| 196 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 182 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 197 voe::Channel* channelPtr = ch.channel(); | 183 voe::Channel* channelPtr = ch.channel(); |
| 198 if (channelPtr == NULL) { | 184 if (channelPtr == NULL) { |
| 199 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 185 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
| 200 "GetPlayoutTimestamp() failed to locate channel"); | 186 "GetPlayoutTimestamp() failed to locate channel"); |
| 201 return -1; | 187 return -1; |
| 202 } | 188 } |
| 203 return channelPtr->GetRtpRtcp(rtpRtcpModule, rtp_receiver); | 189 return channelPtr->GetRtpRtcp(rtpRtcpModule, rtp_receiver); |
| 204 } | 190 } |
| 205 | 191 |
| 206 int VoEVideoSyncImpl::GetLeastRequiredDelayMs(int channel) const { | 192 int VoEVideoSyncImpl::GetLeastRequiredDelayMs(int channel) const { |
| 207 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | |
| 208 "GetLeastRequiredDelayMS(channel=%d)", channel); | |
| 209 | |
| 210 if (!_shared->statistics().Initialized()) { | 193 if (!_shared->statistics().Initialized()) { |
| 211 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 194 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
| 212 return -1; | 195 return -1; |
| 213 } | 196 } |
| 214 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 197 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 215 voe::Channel* channel_ptr = ch.channel(); | 198 voe::Channel* channel_ptr = ch.channel(); |
| 216 if (channel_ptr == NULL) { | 199 if (channel_ptr == NULL) { |
| 217 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 200 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
| 218 "GetLeastRequiredDelayMs() failed to locate channel"); | 201 "GetLeastRequiredDelayMs() failed to locate channel"); |
| 219 return -1; | 202 return -1; |
| 220 } | 203 } |
| 221 return channel_ptr->LeastRequiredDelayMs(); | 204 return channel_ptr->LeastRequiredDelayMs(); |
| 222 } | 205 } |
| 223 | 206 |
| 224 #endif // #ifdef WEBRTC_VOICE_ENGINE_VIDEO_SYNC_API | 207 #endif // #ifdef WEBRTC_VOICE_ENGINE_VIDEO_SYNC_API |
| 225 | 208 |
| 226 } // namespace webrtc | 209 } // namespace webrtc |
| OLD | NEW |