| 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 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1837 | 1837 |
| 1838 if (!output_file_player_) { | 1838 if (!output_file_player_) { |
| 1839 _engineStatisticsPtr->SetLastError( | 1839 _engineStatisticsPtr->SetLastError( |
| 1840 VE_INVALID_ARGUMENT, kTraceError, | 1840 VE_INVALID_ARGUMENT, kTraceError, |
| 1841 "StartPlayingFileLocally() filePlayer format isnot correct"); | 1841 "StartPlayingFileLocally() filePlayer format isnot correct"); |
| 1842 return -1; | 1842 return -1; |
| 1843 } | 1843 } |
| 1844 | 1844 |
| 1845 const uint32_t notificationTime(0); | 1845 const uint32_t notificationTime(0); |
| 1846 | 1846 |
| 1847 if (output_file_player_->StartPlayingFile(*stream, startPosition, | 1847 if (output_file_player_->StartPlayingFile(stream, startPosition, |
| 1848 volumeScaling, notificationTime, | 1848 volumeScaling, notificationTime, |
| 1849 stopPosition, codecInst) != 0) { | 1849 stopPosition, codecInst) != 0) { |
| 1850 _engineStatisticsPtr->SetLastError(VE_BAD_FILE, kTraceError, | 1850 _engineStatisticsPtr->SetLastError(VE_BAD_FILE, kTraceError, |
| 1851 "StartPlayingFile() failed to " | 1851 "StartPlayingFile() failed to " |
| 1852 "start file playout"); | 1852 "start file playout"); |
| 1853 output_file_player_->StopPlayingFile(); | 1853 output_file_player_->StopPlayingFile(); |
| 1854 output_file_player_.reset(); | 1854 output_file_player_.reset(); |
| 1855 return -1; | 1855 return -1; |
| 1856 } | 1856 } |
| 1857 output_file_player_->RegisterModuleFileCallback(this); | 1857 output_file_player_->RegisterModuleFileCallback(this); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2027 | 2027 |
| 2028 if (!input_file_player_) { | 2028 if (!input_file_player_) { |
| 2029 _engineStatisticsPtr->SetLastError( | 2029 _engineStatisticsPtr->SetLastError( |
| 2030 VE_INVALID_ARGUMENT, kTraceError, | 2030 VE_INVALID_ARGUMENT, kTraceError, |
| 2031 "StartPlayingInputFile() filePlayer format isnot correct"); | 2031 "StartPlayingInputFile() filePlayer format isnot correct"); |
| 2032 return -1; | 2032 return -1; |
| 2033 } | 2033 } |
| 2034 | 2034 |
| 2035 const uint32_t notificationTime(0); | 2035 const uint32_t notificationTime(0); |
| 2036 | 2036 |
| 2037 if (input_file_player_->StartPlayingFile(*stream, startPosition, | 2037 if (input_file_player_->StartPlayingFile(stream, startPosition, volumeScaling, |
| 2038 volumeScaling, notificationTime, | 2038 notificationTime, stopPosition, |
| 2039 stopPosition, codecInst) != 0) { | 2039 codecInst) != 0) { |
| 2040 _engineStatisticsPtr->SetLastError(VE_BAD_FILE, kTraceError, | 2040 _engineStatisticsPtr->SetLastError(VE_BAD_FILE, kTraceError, |
| 2041 "StartPlayingFile() failed to start " | 2041 "StartPlayingFile() failed to start " |
| 2042 "file playout"); | 2042 "file playout"); |
| 2043 input_file_player_->StopPlayingFile(); | 2043 input_file_player_->StopPlayingFile(); |
| 2044 input_file_player_.reset(); | 2044 input_file_player_.reset(); |
| 2045 return -1; | 2045 return -1; |
| 2046 } | 2046 } |
| 2047 | 2047 |
| 2048 input_file_player_->RegisterModuleFileCallback(this); | 2048 input_file_player_->RegisterModuleFileCallback(this); |
| 2049 channel_state_.SetInputFilePlaying(true); | 2049 channel_state_.SetInputFilePlaying(true); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2185 | 2185 |
| 2186 output_file_recorder_ = FileRecorder::CreateFileRecorder( | 2186 output_file_recorder_ = FileRecorder::CreateFileRecorder( |
| 2187 _outputFileRecorderId, (const FileFormats)format); | 2187 _outputFileRecorderId, (const FileFormats)format); |
| 2188 if (!output_file_recorder_) { | 2188 if (!output_file_recorder_) { |
| 2189 _engineStatisticsPtr->SetLastError( | 2189 _engineStatisticsPtr->SetLastError( |
| 2190 VE_INVALID_ARGUMENT, kTraceError, | 2190 VE_INVALID_ARGUMENT, kTraceError, |
| 2191 "StartRecordingPlayout() fileRecorder format isnot correct"); | 2191 "StartRecordingPlayout() fileRecorder format isnot correct"); |
| 2192 return -1; | 2192 return -1; |
| 2193 } | 2193 } |
| 2194 | 2194 |
| 2195 if (output_file_recorder_->StartRecordingAudioFile(*stream, *codecInst, | 2195 if (output_file_recorder_->StartRecordingAudioFile(stream, *codecInst, |
| 2196 notificationTime) != 0) { | 2196 notificationTime) != 0) { |
| 2197 _engineStatisticsPtr->SetLastError(VE_BAD_FILE, kTraceError, | 2197 _engineStatisticsPtr->SetLastError(VE_BAD_FILE, kTraceError, |
| 2198 "StartRecordingPlayout() failed to " | 2198 "StartRecordingPlayout() failed to " |
| 2199 "start file recording"); | 2199 "start file recording"); |
| 2200 output_file_recorder_->StopRecording(); | 2200 output_file_recorder_->StopRecording(); |
| 2201 output_file_recorder_.reset(); | 2201 output_file_recorder_.reset(); |
| 2202 return -1; | 2202 return -1; |
| 2203 } | 2203 } |
| 2204 | 2204 |
| 2205 output_file_recorder_->RegisterModuleFileCallback(this); | 2205 output_file_recorder_->RegisterModuleFileCallback(this); |
| (...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3277 { | 3277 { |
| 3278 rtc::CritScope cs(&_fileCritSect); | 3278 rtc::CritScope cs(&_fileCritSect); |
| 3279 | 3279 |
| 3280 if (!input_file_player_) { | 3280 if (!input_file_player_) { |
| 3281 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), | 3281 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), |
| 3282 "Channel::MixOrReplaceAudioWithFile() fileplayer" | 3282 "Channel::MixOrReplaceAudioWithFile() fileplayer" |
| 3283 " doesnt exist"); | 3283 " doesnt exist"); |
| 3284 return -1; | 3284 return -1; |
| 3285 } | 3285 } |
| 3286 | 3286 |
| 3287 if (input_file_player_->Get10msAudioFromFile(fileBuffer.get(), fileSamples, | 3287 if (input_file_player_->Get10msAudioFromFile(fileBuffer.get(), &fileSamples, |
| 3288 mixingFrequency) == -1) { | 3288 mixingFrequency) == -1) { |
| 3289 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), | 3289 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), |
| 3290 "Channel::MixOrReplaceAudioWithFile() file mixing " | 3290 "Channel::MixOrReplaceAudioWithFile() file mixing " |
| 3291 "failed"); | 3291 "failed"); |
| 3292 return -1; | 3292 return -1; |
| 3293 } | 3293 } |
| 3294 if (fileSamples == 0) { | 3294 if (fileSamples == 0) { |
| 3295 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), | 3295 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), |
| 3296 "Channel::MixOrReplaceAudioWithFile() file is ended"); | 3296 "Channel::MixOrReplaceAudioWithFile() file is ended"); |
| 3297 return 0; | 3297 return 0; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 3325 { | 3325 { |
| 3326 rtc::CritScope cs(&_fileCritSect); | 3326 rtc::CritScope cs(&_fileCritSect); |
| 3327 | 3327 |
| 3328 if (!output_file_player_) { | 3328 if (!output_file_player_) { |
| 3329 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), | 3329 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), |
| 3330 "Channel::MixAudioWithFile() file mixing failed"); | 3330 "Channel::MixAudioWithFile() file mixing failed"); |
| 3331 return -1; | 3331 return -1; |
| 3332 } | 3332 } |
| 3333 | 3333 |
| 3334 // We should get the frequency we ask for. | 3334 // We should get the frequency we ask for. |
| 3335 if (output_file_player_->Get10msAudioFromFile(fileBuffer.get(), fileSamples, | 3335 if (output_file_player_->Get10msAudioFromFile( |
| 3336 mixingFrequency) == -1) { | 3336 fileBuffer.get(), &fileSamples, mixingFrequency) == -1) { |
| 3337 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), | 3337 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), |
| 3338 "Channel::MixAudioWithFile() file mixing failed"); | 3338 "Channel::MixAudioWithFile() file mixing failed"); |
| 3339 return -1; | 3339 return -1; |
| 3340 } | 3340 } |
| 3341 } | 3341 } |
| 3342 | 3342 |
| 3343 if (audioFrame.samples_per_channel_ == fileSamples) { | 3343 if (audioFrame.samples_per_channel_ == fileSamples) { |
| 3344 // Currently file stream is always mono. | 3344 // Currently file stream is always mono. |
| 3345 // TODO(xians): Change the code when FilePlayer supports real stereo. | 3345 // TODO(xians): Change the code when FilePlayer supports real stereo. |
| 3346 MixWithSat(audioFrame.data_, audioFrame.num_channels_, fileBuffer.get(), 1, | 3346 MixWithSat(audioFrame.data_, audioFrame.num_channels_, fileBuffer.get(), 1, |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3566 int64_t min_rtt = 0; | 3566 int64_t min_rtt = 0; |
| 3567 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != | 3567 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != |
| 3568 0) { | 3568 0) { |
| 3569 return 0; | 3569 return 0; |
| 3570 } | 3570 } |
| 3571 return rtt; | 3571 return rtt; |
| 3572 } | 3572 } |
| 3573 | 3573 |
| 3574 } // namespace voe | 3574 } // namespace voe |
| 3575 } // namespace webrtc | 3575 } // namespace webrtc |
| OLD | NEW |