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

Side by Side Diff: webrtc/voice_engine/channel.cc

Issue 1347353004: Reduce LS_INFO spam from voice_engine/. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 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 | « talk/media/webrtc/webrtcvoiceengine.cc ('k') | webrtc/voice_engine/transmit_mixer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 "Channel::InFrameType(frame_type=%d)", frame_type); 198 "Channel::InFrameType(frame_type=%d)", frame_type);
199 199
200 CriticalSectionScoped cs(&_callbackCritSect); 200 CriticalSectionScoped cs(&_callbackCritSect);
201 _sendFrameType = (frame_type == kAudioFrameSpeech); 201 _sendFrameType = (frame_type == kAudioFrameSpeech);
202 return 0; 202 return 0;
203 } 203 }
204 204
205 int32_t 205 int32_t
206 Channel::OnRxVadDetected(int vadDecision) 206 Channel::OnRxVadDetected(int vadDecision)
207 { 207 {
208 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
209 "Channel::OnRxVadDetected(vadDecision=%d)", vadDecision);
210
211 CriticalSectionScoped cs(&_callbackCritSect); 208 CriticalSectionScoped cs(&_callbackCritSect);
212 if (_rxVadObserverPtr) 209 if (_rxVadObserverPtr)
213 { 210 {
214 _rxVadObserverPtr->OnRxVad(_channelId, vadDecision); 211 _rxVadObserverPtr->OnRxVad(_channelId, vadDecision);
215 } 212 }
216 213
217 return 0; 214 return 0;
218 } 215 }
219 216
220 int 217 int
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 } 415 }
419 header.payload_type_frequency = 416 header.payload_type_frequency =
420 rtp_payload_registry_->GetPayloadTypeFrequency(header.payloadType); 417 rtp_payload_registry_->GetPayloadTypeFrequency(header.payloadType);
421 if (header.payload_type_frequency < 0) 418 if (header.payload_type_frequency < 0)
422 return false; 419 return false;
423 return ReceivePacket(rtp_packet, rtp_packet_length, header, false); 420 return ReceivePacket(rtp_packet, rtp_packet_length, header, false);
424 } 421 }
425 422
426 int32_t Channel::GetAudioFrame(int32_t id, AudioFrame* audioFrame) 423 int32_t Channel::GetAudioFrame(int32_t id, AudioFrame* audioFrame)
427 { 424 {
428 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId,_channelId),
429 "Channel::GetAudioFrame(id=%d)", id);
430
431 if (event_log_) { 425 if (event_log_) {
432 unsigned int ssrc; 426 unsigned int ssrc;
433 RTC_CHECK_EQ(GetLocalSSRC(ssrc), 0); 427 RTC_CHECK_EQ(GetLocalSSRC(ssrc), 0);
434 event_log_->LogAudioPlayout(ssrc); 428 event_log_->LogAudioPlayout(ssrc);
435 } 429 }
436 // Get 10ms raw PCM data from the ACM (mixer limits output frequency) 430 // Get 10ms raw PCM data from the ACM (mixer limits output frequency)
437 if (audio_coding_->PlayoutData10Ms(audioFrame->sample_rate_hz_, 431 if (audio_coding_->PlayoutData10Ms(audioFrame->sample_rate_hz_,
438 audioFrame) == -1) 432 audioFrame) == -1)
439 { 433 {
440 WEBRTC_TRACE(kTraceError, kTraceVoice, 434 WEBRTC_TRACE(kTraceError, kTraceVoice,
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
1325 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, 1319 VE_AUDIO_CODING_MODULE_ERROR, kTraceError,
1326 "SetVADStatus() failed to set VAD"); 1320 "SetVADStatus() failed to set VAD");
1327 return -1; 1321 return -1;
1328 } 1322 }
1329 return 0; 1323 return 0;
1330 } 1324 }
1331 1325
1332 int32_t 1326 int32_t
1333 Channel::GetVADStatus(bool& enabledVAD, ACMVADMode& mode, bool& disabledDTX) 1327 Channel::GetVADStatus(bool& enabledVAD, ACMVADMode& mode, bool& disabledDTX)
1334 { 1328 {
1335 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
1336 "Channel::GetVADStatus");
1337 if (audio_coding_->VAD(&disabledDTX, &enabledVAD, &mode) != 0) 1329 if (audio_coding_->VAD(&disabledDTX, &enabledVAD, &mode) != 0)
1338 { 1330 {
1339 _engineStatisticsPtr->SetLastError( 1331 _engineStatisticsPtr->SetLastError(
1340 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, 1332 VE_AUDIO_CODING_MODULE_ERROR, kTraceError,
1341 "GetVADStatus() failed to get VAD status"); 1333 "GetVADStatus() failed to get VAD status");
1342 return -1; 1334 return -1;
1343 } 1335 }
1344 disabledDTX = !disabledDTX; 1336 disabledDTX = !disabledDTX;
1345 return 0; 1337 return 0;
1346 } 1338 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 "SetRecPayloadType() ACM registration failed - 1"); 1425 "SetRecPayloadType() ACM registration failed - 1");
1434 return -1; 1426 return -1;
1435 } 1427 }
1436 } 1428 }
1437 return 0; 1429 return 0;
1438 } 1430 }
1439 1431
1440 int32_t 1432 int32_t
1441 Channel::GetRecPayloadType(CodecInst& codec) 1433 Channel::GetRecPayloadType(CodecInst& codec)
1442 { 1434 {
1443 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
1444 "Channel::GetRecPayloadType()");
1445 int8_t payloadType(-1); 1435 int8_t payloadType(-1);
1446 if (rtp_payload_registry_->ReceivePayloadType( 1436 if (rtp_payload_registry_->ReceivePayloadType(
1447 codec.plname, 1437 codec.plname,
1448 codec.plfreq, 1438 codec.plfreq,
1449 codec.channels, 1439 codec.channels,
1450 (codec.rate < 0) ? 0 : codec.rate, 1440 (codec.rate < 0) ? 0 : codec.rate,
1451 &payloadType) != 0) 1441 &payloadType) != 0)
1452 { 1442 {
1453 _engineStatisticsPtr->SetLastError( 1443 _engineStatisticsPtr->SetLastError(
1454 VE_RTP_RTCP_MODULE_ERROR, kTraceWarning, 1444 VE_RTP_RTCP_MODULE_ERROR, kTraceWarning,
1455 "GetRecPayloadType() failed to retrieve RX payload type"); 1445 "GetRecPayloadType() failed to retrieve RX payload type");
1456 return -1; 1446 return -1;
1457 } 1447 }
1458 codec.pltype = payloadType; 1448 codec.pltype = payloadType;
1459 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId,_channelId),
1460 "Channel::GetRecPayloadType() => pltype=%d", codec.pltype);
1461 return 0; 1449 return 0;
1462 } 1450 }
1463 1451
1464 int32_t 1452 int32_t
1465 Channel::SetSendCNPayloadType(int type, PayloadFrequencies frequency) 1453 Channel::SetSendCNPayloadType(int type, PayloadFrequencies frequency)
1466 { 1454 {
1467 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), 1455 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
1468 "Channel::SetSendCNPayloadType()"); 1456 "Channel::SetSendCNPayloadType()");
1469 1457
1470 CodecInst codec; 1458 CodecInst codec;
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1862 return 0; 1850 return 0;
1863 } 1851 }
1864 1852
1865 int Channel::StopPlayingFileLocally() 1853 int Channel::StopPlayingFileLocally()
1866 { 1854 {
1867 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), 1855 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
1868 "Channel::StopPlayingFileLocally()"); 1856 "Channel::StopPlayingFileLocally()");
1869 1857
1870 if (!channel_state_.Get().output_file_playing) 1858 if (!channel_state_.Get().output_file_playing)
1871 { 1859 {
1872 _engineStatisticsPtr->SetLastError(
1873 VE_INVALID_OPERATION, kTraceWarning,
1874 "StopPlayingFileLocally() isnot playing");
1875 return 0; 1860 return 0;
1876 } 1861 }
1877 1862
1878 { 1863 {
1879 CriticalSectionScoped cs(&_fileCritSect); 1864 CriticalSectionScoped cs(&_fileCritSect);
1880 1865
1881 if (_outputFilePlayerPtr->StopPlayingFile() != 0) 1866 if (_outputFilePlayerPtr->StopPlayingFile() != 0)
1882 { 1867 {
1883 _engineStatisticsPtr->SetLastError( 1868 _engineStatisticsPtr->SetLastError(
1884 VE_STOP_RECORDING_FAILED, kTraceError, 1869 VE_STOP_RECORDING_FAILED, kTraceError,
(...skipping 15 matching lines...) Expand all
1900 "StopPlayingFile() failed to stop participant from playing as" 1885 "StopPlayingFile() failed to stop participant from playing as"
1901 "file in the mixer"); 1886 "file in the mixer");
1902 return -1; 1887 return -1;
1903 } 1888 }
1904 1889
1905 return 0; 1890 return 0;
1906 } 1891 }
1907 1892
1908 int Channel::IsPlayingFileLocally() const 1893 int Channel::IsPlayingFileLocally() const
1909 { 1894 {
1910 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
1911 "Channel::IsPlayingFileLocally()");
1912
1913 return channel_state_.Get().output_file_playing; 1895 return channel_state_.Get().output_file_playing;
1914 } 1896 }
1915 1897
1916 int Channel::RegisterFilePlayingToMixer() 1898 int Channel::RegisterFilePlayingToMixer()
1917 { 1899 {
1918 // Return success for not registering for file playing to mixer if: 1900 // Return success for not registering for file playing to mixer if:
1919 // 1. playing file before playout is started on that channel. 1901 // 1. playing file before playout is started on that channel.
1920 // 2. starting playout without file playing on that channel. 1902 // 2. starting playout without file playing on that channel.
1921 if (!channel_state_.Get().playing || 1903 if (!channel_state_.Get().playing ||
1922 !channel_state_.Get().output_file_playing) 1904 !channel_state_.Get().output_file_playing)
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2086 2068
2087 int Channel::StopPlayingFileAsMicrophone() 2069 int Channel::StopPlayingFileAsMicrophone()
2088 { 2070 {
2089 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), 2071 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
2090 "Channel::StopPlayingFileAsMicrophone()"); 2072 "Channel::StopPlayingFileAsMicrophone()");
2091 2073
2092 CriticalSectionScoped cs(&_fileCritSect); 2074 CriticalSectionScoped cs(&_fileCritSect);
2093 2075
2094 if (!channel_state_.Get().input_file_playing) 2076 if (!channel_state_.Get().input_file_playing)
2095 { 2077 {
2096 _engineStatisticsPtr->SetLastError(
2097 VE_INVALID_OPERATION, kTraceWarning,
2098 "StopPlayingFileAsMicrophone() isnot playing");
2099 return 0; 2078 return 0;
2100 } 2079 }
2101 2080
2102 if (_inputFilePlayerPtr->StopPlayingFile() != 0) 2081 if (_inputFilePlayerPtr->StopPlayingFile() != 0)
2103 { 2082 {
2104 _engineStatisticsPtr->SetLastError( 2083 _engineStatisticsPtr->SetLastError(
2105 VE_STOP_RECORDING_FAILED, kTraceError, 2084 VE_STOP_RECORDING_FAILED, kTraceError,
2106 "StopPlayingFile() could not stop playing"); 2085 "StopPlayingFile() could not stop playing");
2107 return -1; 2086 return -1;
2108 } 2087 }
2109 _inputFilePlayerPtr->RegisterModuleFileCallback(NULL); 2088 _inputFilePlayerPtr->RegisterModuleFileCallback(NULL);
2110 FilePlayer::DestroyFilePlayer(_inputFilePlayerPtr); 2089 FilePlayer::DestroyFilePlayer(_inputFilePlayerPtr);
2111 _inputFilePlayerPtr = NULL; 2090 _inputFilePlayerPtr = NULL;
2112 channel_state_.SetInputFilePlaying(false); 2091 channel_state_.SetInputFilePlaying(false);
2113 2092
2114 return 0; 2093 return 0;
2115 } 2094 }
2116 2095
2117 int Channel::IsPlayingFileAsMicrophone() const 2096 int Channel::IsPlayingFileAsMicrophone() const
2118 { 2097 {
2119 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
2120 "Channel::IsPlayingFileAsMicrophone()");
2121 return channel_state_.Get().input_file_playing; 2098 return channel_state_.Get().input_file_playing;
2122 } 2099 }
2123 2100
2124 int Channel::StartRecordingPlayout(const char* fileName, 2101 int Channel::StartRecordingPlayout(const char* fileName,
2125 const CodecInst* codecInst) 2102 const CodecInst* codecInst)
2126 { 2103 {
2127 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), 2104 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
2128 "Channel::StartRecordingPlayout(fileName=%s)", fileName); 2105 "Channel::StartRecordingPlayout(fileName=%s)", fileName);
2129 2106
2130 if (_outputFileRecording) 2107 if (_outputFileRecording)
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
2312 { 2289 {
2313 CriticalSectionScoped cs(&_fileCritSect); 2290 CriticalSectionScoped cs(&_fileCritSect);
2314 _mixFileWithMicrophone=mix; 2291 _mixFileWithMicrophone=mix;
2315 } 2292 }
2316 2293
2317 int 2294 int
2318 Channel::GetSpeechOutputLevel(uint32_t& level) const 2295 Channel::GetSpeechOutputLevel(uint32_t& level) const
2319 { 2296 {
2320 int8_t currentLevel = _outputAudioLevel.Level(); 2297 int8_t currentLevel = _outputAudioLevel.Level();
2321 level = static_cast<int32_t> (currentLevel); 2298 level = static_cast<int32_t> (currentLevel);
2322 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
2323 VoEId(_instanceId,_channelId),
2324 "GetSpeechOutputLevel() => level=%u", level);
2325 return 0; 2299 return 0;
2326 } 2300 }
2327 2301
2328 int 2302 int
2329 Channel::GetSpeechOutputLevelFullRange(uint32_t& level) const 2303 Channel::GetSpeechOutputLevelFullRange(uint32_t& level) const
2330 { 2304 {
2331 int16_t currentLevel = _outputAudioLevel.LevelFullRange(); 2305 int16_t currentLevel = _outputAudioLevel.LevelFullRange();
2332 level = static_cast<int32_t> (currentLevel); 2306 level = static_cast<int32_t> (currentLevel);
2333 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
2334 VoEId(_instanceId,_channelId),
2335 "GetSpeechOutputLevelFullRange() => level=%u", level);
2336 return 0; 2307 return 0;
2337 } 2308 }
2338 2309
2339 int 2310 int
2340 Channel::SetMute(bool enable) 2311 Channel::SetMute(bool enable)
2341 { 2312 {
2342 CriticalSectionScoped cs(&volume_settings_critsect_); 2313 CriticalSectionScoped cs(&volume_settings_critsect_);
2343 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), 2314 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
2344 "Channel::SetMute(enable=%d)", enable); 2315 "Channel::SetMute(enable=%d)", enable);
2345 _mute = enable; 2316 _mute = enable;
(...skipping 17 matching lines...) Expand all
2363 _panRight = right; 2334 _panRight = right;
2364 return 0; 2335 return 0;
2365 } 2336 }
2366 2337
2367 int 2338 int
2368 Channel::GetOutputVolumePan(float& left, float& right) const 2339 Channel::GetOutputVolumePan(float& left, float& right) const
2369 { 2340 {
2370 CriticalSectionScoped cs(&volume_settings_critsect_); 2341 CriticalSectionScoped cs(&volume_settings_critsect_);
2371 left = _panLeft; 2342 left = _panLeft;
2372 right = _panRight; 2343 right = _panRight;
2373 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
2374 VoEId(_instanceId,_channelId),
2375 "GetOutputVolumePan() => left=%3.2f, right=%3.2f", left, right);
2376 return 0; 2344 return 0;
2377 } 2345 }
2378 2346
2379 int 2347 int
2380 Channel::SetChannelOutputVolumeScaling(float scaling) 2348 Channel::SetChannelOutputVolumeScaling(float scaling)
2381 { 2349 {
2382 CriticalSectionScoped cs(&volume_settings_critsect_); 2350 CriticalSectionScoped cs(&volume_settings_critsect_);
2383 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), 2351 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
2384 "Channel::SetChannelOutputVolumeScaling()"); 2352 "Channel::SetChannelOutputVolumeScaling()");
2385 _outputGain = scaling; 2353 _outputGain = scaling;
2386 return 0; 2354 return 0;
2387 } 2355 }
2388 2356
2389 int 2357 int
2390 Channel::GetChannelOutputVolumeScaling(float& scaling) const 2358 Channel::GetChannelOutputVolumeScaling(float& scaling) const
2391 { 2359 {
2392 CriticalSectionScoped cs(&volume_settings_critsect_); 2360 CriticalSectionScoped cs(&volume_settings_critsect_);
2393 scaling = _outputGain; 2361 scaling = _outputGain;
2394 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
2395 VoEId(_instanceId,_channelId),
2396 "GetChannelOutputVolumeScaling() => scaling=%3.2f", scaling);
2397 return 0; 2362 return 0;
2398 } 2363 }
2399 2364
2400 int Channel::SendTelephoneEventOutband(unsigned char eventCode, 2365 int Channel::SendTelephoneEventOutband(unsigned char eventCode,
2401 int lengthMs, int attenuationDb, 2366 int lengthMs, int attenuationDb,
2402 bool playDtmfEvent) 2367 bool playDtmfEvent)
2403 { 2368 {
2404 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), 2369 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
2405 "Channel::SendTelephoneEventOutband(..., playDtmfEvent=%d)", 2370 "Channel::SendTelephoneEventOutband(..., playDtmfEvent=%d)",
2406 playDtmfEvent); 2371 playDtmfEvent);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2461 return -1; 2426 return -1;
2462 } 2427 }
2463 } 2428 }
2464 _sendTelephoneEventPayloadType = type; 2429 _sendTelephoneEventPayloadType = type;
2465 return 0; 2430 return 0;
2466 } 2431 }
2467 2432
2468 int 2433 int
2469 Channel::GetSendTelephoneEventPayloadType(unsigned char& type) 2434 Channel::GetSendTelephoneEventPayloadType(unsigned char& type)
2470 { 2435 {
2471 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
2472 "Channel::GetSendTelephoneEventPayloadType()");
2473 type = _sendTelephoneEventPayloadType; 2436 type = _sendTelephoneEventPayloadType;
2474 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
2475 VoEId(_instanceId,_channelId),
2476 "GetSendTelephoneEventPayloadType() => type=%u", type);
2477 return 0; 2437 return 0;
2478 } 2438 }
2479 2439
2480 int 2440 int
2481 Channel::UpdateRxVadDetection(AudioFrame& audioFrame) 2441 Channel::UpdateRxVadDetection(AudioFrame& audioFrame)
2482 { 2442 {
2483 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId,_channelId), 2443 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId,_channelId),
2484 "Channel::UpdateRxVadDetection()"); 2444 "Channel::UpdateRxVadDetection()");
2485 2445
2486 int vadDecision = 1; 2446 int vadDecision = 1;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2534 } 2494 }
2535 _rxVadObserverPtr = NULL; 2495 _rxVadObserverPtr = NULL;
2536 _RxVadDetection = false; 2496 _RxVadDetection = false;
2537 return 0; 2497 return 0;
2538 } 2498 }
2539 2499
2540 int 2500 int
2541 Channel::VoiceActivityIndicator(int &activity) 2501 Channel::VoiceActivityIndicator(int &activity)
2542 { 2502 {
2543 activity = _sendFrameType; 2503 activity = _sendFrameType;
2544
2545 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
2546 "Channel::VoiceActivityIndicator(indicator=%d)", activity);
2547 return 0; 2504 return 0;
2548 } 2505 }
2549 2506
2550 #ifdef WEBRTC_VOICE_ENGINE_AGC 2507 #ifdef WEBRTC_VOICE_ENGINE_AGC
2551 2508
2552 int 2509 int
2553 Channel::SetRxAgcStatus(bool enable, AgcModes mode) 2510 Channel::SetRxAgcStatus(bool enable, AgcModes mode)
2554 { 2511 {
2555 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), 2512 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
2556 "Channel::SetRxAgcStatus(enable=%d, mode=%d)", 2513 "Channel::SetRxAgcStatus(enable=%d, mode=%d)",
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2594 2551
2595 _rxAgcIsEnabled = enable; 2552 _rxAgcIsEnabled = enable;
2596 channel_state_.SetRxApmIsEnabled(_rxAgcIsEnabled || _rxNsIsEnabled); 2553 channel_state_.SetRxApmIsEnabled(_rxAgcIsEnabled || _rxNsIsEnabled);
2597 2554
2598 return 0; 2555 return 0;
2599 } 2556 }
2600 2557
2601 int 2558 int
2602 Channel::GetRxAgcStatus(bool& enabled, AgcModes& mode) 2559 Channel::GetRxAgcStatus(bool& enabled, AgcModes& mode)
2603 { 2560 {
2604 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
2605 "Channel::GetRxAgcStatus(enable=?, mode=?)");
2606
2607 bool enable = rx_audioproc_->gain_control()->is_enabled(); 2561 bool enable = rx_audioproc_->gain_control()->is_enabled();
2608 GainControl::Mode agcMode = 2562 GainControl::Mode agcMode =
2609 rx_audioproc_->gain_control()->mode(); 2563 rx_audioproc_->gain_control()->mode();
2610 2564
2611 enabled = enable; 2565 enabled = enable;
2612 2566
2613 switch (agcMode) 2567 switch (agcMode)
2614 { 2568 {
2615 case GainControl::kFixedDigital: 2569 case GainControl::kFixedDigital:
2616 mode = kAgcFixedDigital; 2570 mode = kAgcFixedDigital;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2660 "SetRxAgcConfig() failed to set hard limiter to the signal"); 2614 "SetRxAgcConfig() failed to set hard limiter to the signal");
2661 return -1; 2615 return -1;
2662 } 2616 }
2663 2617
2664 return 0; 2618 return 0;
2665 } 2619 }
2666 2620
2667 int 2621 int
2668 Channel::GetRxAgcConfig(AgcConfig& config) 2622 Channel::GetRxAgcConfig(AgcConfig& config)
2669 { 2623 {
2670 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
2671 "Channel::GetRxAgcConfig(config=%?)");
2672
2673 config.targetLeveldBOv = 2624 config.targetLeveldBOv =
2674 rx_audioproc_->gain_control()->target_level_dbfs(); 2625 rx_audioproc_->gain_control()->target_level_dbfs();
2675 config.digitalCompressionGaindB = 2626 config.digitalCompressionGaindB =
2676 rx_audioproc_->gain_control()->compression_gain_db(); 2627 rx_audioproc_->gain_control()->compression_gain_db();
2677 config.limiterEnable = 2628 config.limiterEnable =
2678 rx_audioproc_->gain_control()->is_limiter_enabled(); 2629 rx_audioproc_->gain_control()->is_limiter_enabled();
2679 2630
2680 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
2681 VoEId(_instanceId,_channelId), "GetRxAgcConfig() => "
2682 "targetLeveldBOv=%u, digitalCompressionGaindB=%u,"
2683 " limiterEnable=%d",
2684 config.targetLeveldBOv,
2685 config.digitalCompressionGaindB,
2686 config.limiterEnable);
2687
2688 return 0; 2631 return 0;
2689 } 2632 }
2690 2633
2691 #endif // #ifdef WEBRTC_VOICE_ENGINE_AGC 2634 #endif // #ifdef WEBRTC_VOICE_ENGINE_AGC
2692 2635
2693 #ifdef WEBRTC_VOICE_ENGINE_NR 2636 #ifdef WEBRTC_VOICE_ENGINE_NR
2694 2637
2695 int 2638 int
2696 Channel::SetRxNsStatus(bool enable, NsModes mode) 2639 Channel::SetRxNsStatus(bool enable, NsModes mode)
2697 { 2640 {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2743 2686
2744 _rxNsIsEnabled = enable; 2687 _rxNsIsEnabled = enable;
2745 channel_state_.SetRxApmIsEnabled(_rxAgcIsEnabled || _rxNsIsEnabled); 2688 channel_state_.SetRxApmIsEnabled(_rxAgcIsEnabled || _rxNsIsEnabled);
2746 2689
2747 return 0; 2690 return 0;
2748 } 2691 }
2749 2692
2750 int 2693 int
2751 Channel::GetRxNsStatus(bool& enabled, NsModes& mode) 2694 Channel::GetRxNsStatus(bool& enabled, NsModes& mode)
2752 { 2695 {
2753 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
2754 "Channel::GetRxNsStatus(enable=?, mode=?)");
2755
2756 bool enable = 2696 bool enable =
2757 rx_audioproc_->noise_suppression()->is_enabled(); 2697 rx_audioproc_->noise_suppression()->is_enabled();
2758 NoiseSuppression::Level ncLevel = 2698 NoiseSuppression::Level ncLevel =
2759 rx_audioproc_->noise_suppression()->level(); 2699 rx_audioproc_->noise_suppression()->level();
2760 2700
2761 enabled = enable; 2701 enabled = enable;
2762 2702
2763 switch (ncLevel) 2703 switch (ncLevel)
2764 { 2704 {
2765 case NoiseSuppression::kLow: 2705 case NoiseSuppression::kLow:
2766 mode = kNsLowSuppression; 2706 mode = kNsLowSuppression;
2767 break; 2707 break;
2768 case NoiseSuppression::kModerate: 2708 case NoiseSuppression::kModerate:
2769 mode = kNsModerateSuppression; 2709 mode = kNsModerateSuppression;
2770 break; 2710 break;
2771 case NoiseSuppression::kHigh: 2711 case NoiseSuppression::kHigh:
2772 mode = kNsHighSuppression; 2712 mode = kNsHighSuppression;
2773 break; 2713 break;
2774 case NoiseSuppression::kVeryHigh: 2714 case NoiseSuppression::kVeryHigh:
2775 mode = kNsVeryHighSuppression; 2715 mode = kNsVeryHighSuppression;
2776 break; 2716 break;
2777 } 2717 }
2778 2718
2779 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
2780 VoEId(_instanceId,_channelId),
2781 "GetRxNsStatus() => enabled=%d, mode=%d", enabled, mode);
2782 return 0; 2719 return 0;
2783 } 2720 }
2784 2721
2785 #endif // #ifdef WEBRTC_VOICE_ENGINE_NR 2722 #endif // #ifdef WEBRTC_VOICE_ENGINE_NR
2786 2723
2787 int 2724 int
2788 Channel::SetLocalSSRC(unsigned int ssrc) 2725 Channel::SetLocalSSRC(unsigned int ssrc)
2789 { 2726 {
2790 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), 2727 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
2791 "Channel::SetLocalSSRC()"); 2728 "Channel::SetLocalSSRC()");
2792 if (channel_state_.Get().sending) 2729 if (channel_state_.Get().sending)
2793 { 2730 {
2794 _engineStatisticsPtr->SetLastError( 2731 _engineStatisticsPtr->SetLastError(
2795 VE_ALREADY_SENDING, kTraceError, 2732 VE_ALREADY_SENDING, kTraceError,
2796 "SetLocalSSRC() already sending"); 2733 "SetLocalSSRC() already sending");
2797 return -1; 2734 return -1;
2798 } 2735 }
2799 _rtpRtcpModule->SetSSRC(ssrc); 2736 _rtpRtcpModule->SetSSRC(ssrc);
2800 return 0; 2737 return 0;
2801 } 2738 }
2802 2739
2803 int 2740 int
2804 Channel::GetLocalSSRC(unsigned int& ssrc) 2741 Channel::GetLocalSSRC(unsigned int& ssrc)
2805 { 2742 {
2806 ssrc = _rtpRtcpModule->SSRC(); 2743 ssrc = _rtpRtcpModule->SSRC();
2807 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
2808 VoEId(_instanceId,_channelId),
2809 "GetLocalSSRC() => ssrc=%lu", ssrc);
2810 return 0; 2744 return 0;
2811 } 2745 }
2812 2746
2813 int 2747 int
2814 Channel::GetRemoteSSRC(unsigned int& ssrc) 2748 Channel::GetRemoteSSRC(unsigned int& ssrc)
2815 { 2749 {
2816 ssrc = rtp_receiver_->SSRC(); 2750 ssrc = rtp_receiver_->SSRC();
2817 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
2818 VoEId(_instanceId,_channelId),
2819 "GetRemoteSSRC() => ssrc=%lu", ssrc);
2820 return 0; 2751 return 0;
2821 } 2752 }
2822 2753
2823 int Channel::SetSendAudioLevelIndicationStatus(bool enable, unsigned char id) { 2754 int Channel::SetSendAudioLevelIndicationStatus(bool enable, unsigned char id) {
2824 _includeAudioLevelIndication = enable; 2755 _includeAudioLevelIndication = enable;
2825 return SetSendRtpHeaderExtension(enable, kRtpExtensionAudioLevel, id); 2756 return SetSendRtpHeaderExtension(enable, kRtpExtensionAudioLevel, id);
2826 } 2757 }
2827 2758
2828 int Channel::SetReceiveAudioLevelIndicationStatus(bool enable, 2759 int Channel::SetReceiveAudioLevelIndicationStatus(bool enable,
2829 unsigned char id) { 2760 unsigned char id) {
(...skipping 24 matching lines...) Expand all
2854 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), 2785 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
2855 "Channel::SetRTCPStatus()"); 2786 "Channel::SetRTCPStatus()");
2856 _rtpRtcpModule->SetRTCPStatus(enable ? kRtcpCompound : kRtcpOff); 2787 _rtpRtcpModule->SetRTCPStatus(enable ? kRtcpCompound : kRtcpOff);
2857 } 2788 }
2858 2789
2859 int 2790 int
2860 Channel::GetRTCPStatus(bool& enabled) 2791 Channel::GetRTCPStatus(bool& enabled)
2861 { 2792 {
2862 RTCPMethod method = _rtpRtcpModule->RTCP(); 2793 RTCPMethod method = _rtpRtcpModule->RTCP();
2863 enabled = (method != kRtcpOff); 2794 enabled = (method != kRtcpOff);
2864 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
2865 VoEId(_instanceId,_channelId),
2866 "GetRTCPStatus() => enabled=%d", enabled);
2867 return 0; 2795 return 0;
2868 } 2796 }
2869 2797
2870 int 2798 int
2871 Channel::SetRTCP_CNAME(const char cName[256]) 2799 Channel::SetRTCP_CNAME(const char cName[256])
2872 { 2800 {
2873 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), 2801 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
2874 "Channel::SetRTCP_CNAME()"); 2802 "Channel::SetRTCP_CNAME()");
2875 if (_rtpRtcpModule->SetCNAME(cName) != 0) 2803 if (_rtpRtcpModule->SetCNAME(cName) != 0)
2876 { 2804 {
(...skipping 18 matching lines...) Expand all
2895 char cname[RTCP_CNAME_SIZE]; 2823 char cname[RTCP_CNAME_SIZE];
2896 const uint32_t remoteSSRC = rtp_receiver_->SSRC(); 2824 const uint32_t remoteSSRC = rtp_receiver_->SSRC();
2897 if (_rtpRtcpModule->RemoteCNAME(remoteSSRC, cname) != 0) 2825 if (_rtpRtcpModule->RemoteCNAME(remoteSSRC, cname) != 0)
2898 { 2826 {
2899 _engineStatisticsPtr->SetLastError( 2827 _engineStatisticsPtr->SetLastError(
2900 VE_CANNOT_RETRIEVE_CNAME, kTraceError, 2828 VE_CANNOT_RETRIEVE_CNAME, kTraceError,
2901 "GetRemoteRTCP_CNAME() failed to retrieve remote RTCP CNAME"); 2829 "GetRemoteRTCP_CNAME() failed to retrieve remote RTCP CNAME");
2902 return -1; 2830 return -1;
2903 } 2831 }
2904 strcpy(cName, cname); 2832 strcpy(cName, cname);
2905 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
2906 VoEId(_instanceId, _channelId),
2907 "GetRemoteRTCP_CNAME() => cName=%s", cName);
2908 return 0; 2833 return 0;
2909 } 2834 }
2910 2835
2911 int 2836 int
2912 Channel::GetRemoteRTCPData( 2837 Channel::GetRemoteRTCPData(
2913 unsigned int& NTPHigh, 2838 unsigned int& NTPHigh,
2914 unsigned int& NTPLow, 2839 unsigned int& NTPLow,
2915 unsigned int& timestamp, 2840 unsigned int& timestamp,
2916 unsigned int& playoutTimestamp, 2841 unsigned int& playoutTimestamp,
2917 unsigned int* jitter, 2842 unsigned int* jitter,
(...skipping 10 matching lines...) Expand all
2928 "side"); 2853 "side");
2929 return -1; 2854 return -1;
2930 } 2855 }
2931 2856
2932 // We only utilize 12 out of 20 bytes in the sender info (ignores packet 2857 // We only utilize 12 out of 20 bytes in the sender info (ignores packet
2933 // and octet count) 2858 // and octet count)
2934 NTPHigh = senderInfo.NTPseconds; 2859 NTPHigh = senderInfo.NTPseconds;
2935 NTPLow = senderInfo.NTPfraction; 2860 NTPLow = senderInfo.NTPfraction;
2936 timestamp = senderInfo.RTPtimeStamp; 2861 timestamp = senderInfo.RTPtimeStamp;
2937 2862
2938 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
2939 VoEId(_instanceId, _channelId),
2940 "GetRemoteRTCPData() => NTPHigh=%lu, NTPLow=%lu, "
2941 "timestamp=%lu",
2942 NTPHigh, NTPLow, timestamp);
2943
2944 // --- Locally derived information 2863 // --- Locally derived information
2945 2864
2946 // This value is updated on each incoming RTCP packet (0 when no packet 2865 // This value is updated on each incoming RTCP packet (0 when no packet
2947 // has been received) 2866 // has been received)
2948 playoutTimestamp = playout_timestamp_rtcp_; 2867 playoutTimestamp = playout_timestamp_rtcp_;
2949 2868
2950 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
2951 VoEId(_instanceId, _channelId),
2952 "GetRemoteRTCPData() => playoutTimestamp=%lu",
2953 playout_timestamp_rtcp_);
2954
2955 if (NULL != jitter || NULL != fractionLost) 2869 if (NULL != jitter || NULL != fractionLost)
2956 { 2870 {
2957 // Get all RTCP receiver report blocks that have been received on this 2871 // Get all RTCP receiver report blocks that have been received on this
2958 // channel. If we receive RTP packets from a remote source we know the 2872 // channel. If we receive RTP packets from a remote source we know the
2959 // remote SSRC and use the report block from him. 2873 // remote SSRC and use the report block from him.
2960 // Otherwise use the first report block. 2874 // Otherwise use the first report block.
2961 std::vector<RTCPReportBlock> remote_stats; 2875 std::vector<RTCPReportBlock> remote_stats;
2962 if (_rtpRtcpModule->RemoteRTCPStat(&remote_stats) != 0 || 2876 if (_rtpRtcpModule->RemoteRTCPStat(&remote_stats) != 0 ||
2963 remote_stats.empty()) { 2877 remote_stats.empty()) {
2964 WEBRTC_TRACE(kTraceWarning, kTraceVoice, 2878 WEBRTC_TRACE(kTraceWarning, kTraceVoice,
(...skipping 13 matching lines...) Expand all
2978 if (it == remote_stats.end()) { 2892 if (it == remote_stats.end()) {
2979 // If we have not received any RTCP packets from this SSRC it probably 2893 // If we have not received any RTCP packets from this SSRC it probably
2980 // means that we have not received any RTP packets. 2894 // means that we have not received any RTP packets.
2981 // Use the first received report block instead. 2895 // Use the first received report block instead.
2982 it = remote_stats.begin(); 2896 it = remote_stats.begin();
2983 remoteSSRC = it->remoteSSRC; 2897 remoteSSRC = it->remoteSSRC;
2984 } 2898 }
2985 2899
2986 if (jitter) { 2900 if (jitter) {
2987 *jitter = it->jitter; 2901 *jitter = it->jitter;
2988 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
2989 VoEId(_instanceId, _channelId),
2990 "GetRemoteRTCPData() => jitter = %lu", *jitter);
2991 } 2902 }
2992 2903
2993 if (fractionLost) { 2904 if (fractionLost) {
2994 *fractionLost = it->fractionLost; 2905 *fractionLost = it->fractionLost;
2995 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
2996 VoEId(_instanceId, _channelId),
2997 "GetRemoteRTCPData() => fractionLost = %lu",
2998 *fractionLost);
2999 } 2906 }
3000 } 2907 }
3001 return 0; 2908 return 0;
3002 } 2909 }
3003 2910
3004 int 2911 int
3005 Channel::SendApplicationDefinedRTCPPacket(unsigned char subType, 2912 Channel::SendApplicationDefinedRTCPPacket(unsigned char subType,
3006 unsigned int name, 2913 unsigned int name,
3007 const char* data, 2914 const char* data,
3008 unsigned short dataLengthInBytes) 2915 unsigned short dataLengthInBytes)
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
3078 ChannelStatistics stats = statistics_proxy_->GetStats(); 2985 ChannelStatistics stats = statistics_proxy_->GetStats();
3079 const int32_t playoutFrequency = audio_coding_->PlayoutFrequency(); 2986 const int32_t playoutFrequency = audio_coding_->PlayoutFrequency();
3080 if (playoutFrequency > 0) { 2987 if (playoutFrequency > 0) {
3081 // Scale RTP statistics given the current playout frequency 2988 // Scale RTP statistics given the current playout frequency
3082 maxJitterMs = stats.max_jitter / (playoutFrequency / 1000); 2989 maxJitterMs = stats.max_jitter / (playoutFrequency / 1000);
3083 averageJitterMs = stats.rtcp.jitter / (playoutFrequency / 1000); 2990 averageJitterMs = stats.rtcp.jitter / (playoutFrequency / 1000);
3084 } 2991 }
3085 2992
3086 discardedPackets = _numberOfDiscardedPackets; 2993 discardedPackets = _numberOfDiscardedPackets;
3087 2994
3088 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
3089 VoEId(_instanceId, _channelId),
3090 "GetRTPStatistics() => averageJitterMs = %lu, maxJitterMs = %lu,"
3091 " discardedPackets = %lu)",
3092 averageJitterMs, maxJitterMs, discardedPackets);
3093 return 0; 2995 return 0;
3094 } 2996 }
3095 2997
3096 int Channel::GetRemoteRTCPReportBlocks( 2998 int Channel::GetRemoteRTCPReportBlocks(
3097 std::vector<ReportBlock>* report_blocks) { 2999 std::vector<ReportBlock>* report_blocks) {
3098 if (report_blocks == NULL) { 3000 if (report_blocks == NULL) {
3099 _engineStatisticsPtr->SetLastError(VE_INVALID_ARGUMENT, kTraceError, 3001 _engineStatisticsPtr->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
3100 "GetRemoteRTCPReportBlock()s invalid report_blocks."); 3002 "GetRemoteRTCPReportBlock()s invalid report_blocks.");
3101 return -1; 3003 return -1;
3102 } 3004 }
3103 3005
3104 // Get the report blocks from the latest received RTCP Sender or Receiver 3006 // Get the report blocks from the latest received RTCP Sender or Receiver
3105 // Report. Each element in the vector contains the sender's SSRC and a 3007 // Report. Each element in the vector contains the sender's SSRC and a
3106 // report block according to RFC 3550. 3008 // report block according to RFC 3550.
3107 std::vector<RTCPReportBlock> rtcp_report_blocks; 3009 std::vector<RTCPReportBlock> rtcp_report_blocks;
3108 if (_rtpRtcpModule->RemoteRTCPStat(&rtcp_report_blocks) != 0) { 3010 if (_rtpRtcpModule->RemoteRTCPStat(&rtcp_report_blocks) != 0) {
3109 _engineStatisticsPtr->SetLastError(VE_RTP_RTCP_MODULE_ERROR, kTraceError,
3110 "GetRemoteRTCPReportBlocks() failed to read RTCP SR/RR report block.");
3111 return -1; 3011 return -1;
3112 } 3012 }
3113 3013
3114 if (rtcp_report_blocks.empty()) 3014 if (rtcp_report_blocks.empty())
3115 return 0; 3015 return 0;
3116 3016
3117 std::vector<RTCPReportBlock>::const_iterator it = rtcp_report_blocks.begin(); 3017 std::vector<RTCPReportBlock>::const_iterator it = rtcp_report_blocks.begin();
3118 for (; it != rtcp_report_blocks.end(); ++it) { 3018 for (; it != rtcp_report_blocks.end(); ++it) {
3119 ReportBlock report_block; 3019 ReportBlock report_block;
3120 report_block.sender_SSRC = it->remoteSSRC; 3020 report_block.sender_SSRC = it->remoteSSRC;
(...skipping 25 matching lines...) Expand all
3146 VE_CANNOT_RETRIEVE_RTP_STAT, kTraceWarning, 3046 VE_CANNOT_RETRIEVE_RTP_STAT, kTraceWarning,
3147 "GetRTPStatistics() failed to read RTP statistics from the " 3047 "GetRTPStatistics() failed to read RTP statistics from the "
3148 "RTP/RTCP module"); 3048 "RTP/RTCP module");
3149 } 3049 }
3150 3050
3151 stats.fractionLost = statistics.fraction_lost; 3051 stats.fractionLost = statistics.fraction_lost;
3152 stats.cumulativeLost = statistics.cumulative_lost; 3052 stats.cumulativeLost = statistics.cumulative_lost;
3153 stats.extendedMax = statistics.extended_max_sequence_number; 3053 stats.extendedMax = statistics.extended_max_sequence_number;
3154 stats.jitterSamples = statistics.jitter; 3054 stats.jitterSamples = statistics.jitter;
3155 3055
3156 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
3157 VoEId(_instanceId, _channelId),
3158 "GetRTPStatistics() => fractionLost=%lu, cumulativeLost=%lu,"
3159 " extendedMax=%lu, jitterSamples=%li)",
3160 stats.fractionLost, stats.cumulativeLost, stats.extendedMax,
3161 stats.jitterSamples);
3162
3163 // --- RTT 3056 // --- RTT
3164 stats.rttMs = GetRTT(true); 3057 stats.rttMs = GetRTT(true);
3165 if (stats.rttMs == 0) {
3166 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId),
3167 "GetRTPStatistics() failed to get RTT");
3168 } else {
3169 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId, _channelId),
3170 "GetRTPStatistics() => rttMs=%" PRId64, stats.rttMs);
3171 }
3172 3058
3173 // --- Data counters 3059 // --- Data counters
3174 3060
3175 size_t bytesSent(0); 3061 size_t bytesSent(0);
3176 uint32_t packetsSent(0); 3062 uint32_t packetsSent(0);
3177 size_t bytesReceived(0); 3063 size_t bytesReceived(0);
3178 uint32_t packetsReceived(0); 3064 uint32_t packetsReceived(0);
3179 3065
3180 if (statistician) { 3066 if (statistician) {
3181 statistician->GetDataCounters(&bytesReceived, &packetsReceived); 3067 statistician->GetDataCounters(&bytesReceived, &packetsReceived);
3182 } 3068 }
3183 3069
3184 if (_rtpRtcpModule->DataCountersRTP(&bytesSent, 3070 if (_rtpRtcpModule->DataCountersRTP(&bytesSent,
3185 &packetsSent) != 0) 3071 &packetsSent) != 0)
3186 { 3072 {
3187 WEBRTC_TRACE(kTraceWarning, kTraceVoice, 3073 WEBRTC_TRACE(kTraceWarning, kTraceVoice,
3188 VoEId(_instanceId, _channelId), 3074 VoEId(_instanceId, _channelId),
3189 "GetRTPStatistics() failed to retrieve RTP datacounters =>" 3075 "GetRTPStatistics() failed to retrieve RTP datacounters =>"
3190 " output will not be complete"); 3076 " output will not be complete");
3191 } 3077 }
3192 3078
3193 stats.bytesSent = bytesSent; 3079 stats.bytesSent = bytesSent;
3194 stats.packetsSent = packetsSent; 3080 stats.packetsSent = packetsSent;
3195 stats.bytesReceived = bytesReceived; 3081 stats.bytesReceived = bytesReceived;
3196 stats.packetsReceived = packetsReceived; 3082 stats.packetsReceived = packetsReceived;
3197 3083
3198 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
3199 VoEId(_instanceId, _channelId),
3200 "GetRTPStatistics() => bytesSent=%" PRIuS ", packetsSent=%d,"
3201 " bytesReceived=%" PRIuS ", packetsReceived=%d)",
3202 stats.bytesSent, stats.packetsSent, stats.bytesReceived,
3203 stats.packetsReceived);
3204
3205 // --- Timestamps 3084 // --- Timestamps
3206 { 3085 {
3207 CriticalSectionScoped lock(ts_stats_lock_.get()); 3086 CriticalSectionScoped lock(ts_stats_lock_.get());
3208 stats.capture_start_ntp_time_ms_ = capture_start_ntp_time_ms_; 3087 stats.capture_start_ntp_time_ms_ = capture_start_ntp_time_ms_;
3209 } 3088 }
3210 return 0; 3089 return 0;
3211 } 3090 }
3212 3091
3213 int Channel::SetREDStatus(bool enable, int redPayloadtype) { 3092 int Channel::SetREDStatus(bool enable, int redPayloadtype) {
3214 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), 3093 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
3248 int8_t payloadType(0); 3127 int8_t payloadType(0);
3249 if (_rtpRtcpModule->SendREDPayloadType(payloadType) != 0) 3128 if (_rtpRtcpModule->SendREDPayloadType(payloadType) != 0)
3250 { 3129 {
3251 _engineStatisticsPtr->SetLastError( 3130 _engineStatisticsPtr->SetLastError(
3252 VE_RTP_RTCP_MODULE_ERROR, kTraceError, 3131 VE_RTP_RTCP_MODULE_ERROR, kTraceError,
3253 "GetREDStatus() failed to retrieve RED PT from RTP/RTCP " 3132 "GetREDStatus() failed to retrieve RED PT from RTP/RTCP "
3254 "module"); 3133 "module");
3255 return -1; 3134 return -1;
3256 } 3135 }
3257 redPayloadtype = payloadType; 3136 redPayloadtype = payloadType;
3258 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
3259 VoEId(_instanceId, _channelId),
3260 "GetREDStatus() => enabled=%d, redPayloadtype=%d",
3261 enabled, redPayloadtype);
3262 return 0; 3137 return 0;
3263 } 3138 }
3264 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
3265 VoEId(_instanceId, _channelId),
3266 "GetREDStatus() => enabled=%d", enabled);
3267 return 0; 3139 return 0;
3268 } 3140 }
3269 3141
3270 int Channel::SetCodecFECStatus(bool enable) { 3142 int Channel::SetCodecFECStatus(bool enable) {
3271 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), 3143 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
3272 "Channel::SetCodecFECStatus()"); 3144 "Channel::SetCodecFECStatus()");
3273 3145
3274 if (audio_coding_->SetCodecFEC(enable) != 0) { 3146 if (audio_coding_->SetCodecFEC(enable) != 0) {
3275 _engineStatisticsPtr->SetLastError( 3147 _engineStatisticsPtr->SetLastError(
3276 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, 3148 VE_AUDIO_CODING_MODULE_ERROR, kTraceError,
3277 "SetCodecFECStatus() failed to set FEC state"); 3149 "SetCodecFECStatus() failed to set FEC state");
3278 return -1; 3150 return -1;
3279 } 3151 }
3280 return 0; 3152 return 0;
3281 } 3153 }
3282 3154
3283 bool Channel::GetCodecFECStatus() { 3155 bool Channel::GetCodecFECStatus() {
3284 bool enabled = audio_coding_->CodecFEC(); 3156 bool enabled = audio_coding_->CodecFEC();
3285 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
3286 VoEId(_instanceId, _channelId),
3287 "GetCodecFECStatus() => enabled=%d", enabled);
3288 return enabled; 3157 return enabled;
3289 } 3158 }
3290 3159
3291 void Channel::SetNACKStatus(bool enable, int maxNumberOfPackets) { 3160 void Channel::SetNACKStatus(bool enable, int maxNumberOfPackets) {
3292 // None of these functions can fail. 3161 // None of these functions can fail.
3293 _rtpRtcpModule->SetStorePacketsStatus(enable, maxNumberOfPackets); 3162 _rtpRtcpModule->SetStorePacketsStatus(enable, maxNumberOfPackets);
3294 rtp_receive_statistics_->SetMaxReorderingThreshold(maxNumberOfPackets); 3163 rtp_receive_statistics_->SetMaxReorderingThreshold(maxNumberOfPackets);
3295 rtp_receiver_->SetNACKStatus(enable ? kNackRtcp : kNackOff); 3164 rtp_receiver_->SetNACKStatus(enable ? kNackRtcp : kNackOff);
3296 if (enable) 3165 if (enable)
3297 audio_coding_->EnableNack(maxNumberOfPackets); 3166 audio_coding_->EnableNack(maxNumberOfPackets);
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
3524 } 3393 }
3525 3394
3526 _externalMixing = enabled; 3395 _externalMixing = enabled;
3527 3396
3528 return 0; 3397 return 0;
3529 } 3398 }
3530 3399
3531 int 3400 int
3532 Channel::GetNetworkStatistics(NetworkStatistics& stats) 3401 Channel::GetNetworkStatistics(NetworkStatistics& stats)
3533 { 3402 {
3534 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
3535 "Channel::GetNetworkStatistics()");
3536 return audio_coding_->GetNetworkStatistics(&stats); 3403 return audio_coding_->GetNetworkStatistics(&stats);
3537 } 3404 }
3538 3405
3539 void Channel::GetDecodingCallStatistics(AudioDecodingCallStats* stats) const { 3406 void Channel::GetDecodingCallStatistics(AudioDecodingCallStats* stats) const {
3540 audio_coding_->GetDecodingCallStatistics(stats); 3407 audio_coding_->GetDecodingCallStatistics(stats);
3541 } 3408 }
3542 3409
3543 bool Channel::GetDelayEstimate(int* jitter_buffer_delay_ms, 3410 bool Channel::GetDelayEstimate(int* jitter_buffer_delay_ms,
3544 int* playout_buffer_delay_ms) const { 3411 int* playout_buffer_delay_ms) const {
3545 CriticalSectionScoped cs(video_sync_lock_.get()); 3412 CriticalSectionScoped cs(video_sync_lock_.get());
3546 if (_average_jitter_buffer_delay_us == 0) { 3413 if (_average_jitter_buffer_delay_us == 0) {
3547 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
3548 "Channel::GetDelayEstimate() no valid estimate.");
3549 return false; 3414 return false;
3550 } 3415 }
3551 *jitter_buffer_delay_ms = (_average_jitter_buffer_delay_us + 500) / 1000 + 3416 *jitter_buffer_delay_ms = (_average_jitter_buffer_delay_us + 500) / 1000 +
3552 _recPacketDelayMs; 3417 _recPacketDelayMs;
3553 *playout_buffer_delay_ms = playout_delay_ms_; 3418 *playout_buffer_delay_ms = playout_delay_ms_;
3554 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
3555 "Channel::GetDelayEstimate()");
3556 return true; 3419 return true;
3557 } 3420 }
3558 3421
3559 int Channel::LeastRequiredDelayMs() const { 3422 int Channel::LeastRequiredDelayMs() const {
3560 return audio_coding_->LeastRequiredDelayMs(); 3423 return audio_coding_->LeastRequiredDelayMs();
3561 } 3424 }
3562 3425
3563 int Channel::SetInitialPlayoutDelay(int delay_ms) 3426 int Channel::SetInitialPlayoutDelay(int delay_ms)
3564 { 3427 {
3565 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), 3428 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
3600 { 3463 {
3601 _engineStatisticsPtr->SetLastError( 3464 _engineStatisticsPtr->SetLastError(
3602 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, 3465 VE_AUDIO_CODING_MODULE_ERROR, kTraceError,
3603 "SetMinimumPlayoutDelay() failed to set min playout delay"); 3466 "SetMinimumPlayoutDelay() failed to set min playout delay");
3604 return -1; 3467 return -1;
3605 } 3468 }
3606 return 0; 3469 return 0;
3607 } 3470 }
3608 3471
3609 int Channel::GetPlayoutTimestamp(unsigned int& timestamp) { 3472 int Channel::GetPlayoutTimestamp(unsigned int& timestamp) {
3610 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
3611 "Channel::GetPlayoutTimestamp()");
3612 uint32_t playout_timestamp_rtp = 0; 3473 uint32_t playout_timestamp_rtp = 0;
3613 { 3474 {
3614 CriticalSectionScoped cs(video_sync_lock_.get()); 3475 CriticalSectionScoped cs(video_sync_lock_.get());
3615 playout_timestamp_rtp = playout_timestamp_rtp_; 3476 playout_timestamp_rtp = playout_timestamp_rtp_;
3616 } 3477 }
3617 if (playout_timestamp_rtp == 0) { 3478 if (playout_timestamp_rtp == 0) {
3618 _engineStatisticsPtr->SetLastError( 3479 _engineStatisticsPtr->SetLastError(
3619 VE_CANNOT_RETRIEVE_VALUE, kTraceError, 3480 VE_CANNOT_RETRIEVE_VALUE, kTraceError,
3620 "GetPlayoutTimestamp() failed to retrieve timestamp"); 3481 "GetPlayoutTimestamp() failed to retrieve timestamp");
3621 return -1; 3482 return -1;
3622 } 3483 }
3623 timestamp = playout_timestamp_rtp; 3484 timestamp = playout_timestamp_rtp;
3624 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
3625 VoEId(_instanceId,_channelId),
3626 "GetPlayoutTimestamp() => timestamp=%u", timestamp);
3627 return 0; 3485 return 0;
3628 } 3486 }
3629 3487
3630 int Channel::SetInitTimestamp(unsigned int timestamp) { 3488 int Channel::SetInitTimestamp(unsigned int timestamp) {
3631 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), 3489 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
3632 "Channel::SetInitTimestamp()"); 3490 "Channel::SetInitTimestamp()");
3633 if (channel_state_.Get().sending) { 3491 if (channel_state_.Get().sending) {
3634 _engineStatisticsPtr->SetLastError(VE_SENDING, kTraceError, 3492 _engineStatisticsPtr->SetLastError(VE_SENDING, kTraceError,
3635 "SetInitTimestamp() already sending"); 3493 "SetInitTimestamp() already sending");
3636 return -1; 3494 return -1;
(...skipping 10 matching lines...) Expand all
3647 VE_SENDING, kTraceError, "SetInitSequenceNumber() already sending"); 3505 VE_SENDING, kTraceError, "SetInitSequenceNumber() already sending");
3648 return -1; 3506 return -1;
3649 } 3507 }
3650 _rtpRtcpModule->SetSequenceNumber(sequenceNumber); 3508 _rtpRtcpModule->SetSequenceNumber(sequenceNumber);
3651 return 0; 3509 return 0;
3652 } 3510 }
3653 3511
3654 int 3512 int
3655 Channel::GetRtpRtcp(RtpRtcp** rtpRtcpModule, RtpReceiver** rtp_receiver) const 3513 Channel::GetRtpRtcp(RtpRtcp** rtpRtcpModule, RtpReceiver** rtp_receiver) const
3656 { 3514 {
3657 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
3658 "Channel::GetRtpRtcp()");
3659 *rtpRtcpModule = _rtpRtcpModule.get(); 3515 *rtpRtcpModule = _rtpRtcpModule.get();
3660 *rtp_receiver = rtp_receiver_.get(); 3516 *rtp_receiver = rtp_receiver_.get();
3661 return 0; 3517 return 0;
3662 } 3518 }
3663 3519
3664 // TODO(andrew): refactor Mix functions here and in transmit_mixer.cc to use 3520 // TODO(andrew): refactor Mix functions here and in transmit_mixer.cc to use
3665 // a shared helper. 3521 // a shared helper.
3666 int32_t 3522 int32_t
3667 Channel::MixOrReplaceAudioWithFile(int mixingFrequency) 3523 Channel::MixOrReplaceAudioWithFile(int mixingFrequency)
3668 { 3524 {
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
3967 1000 * timestamp_diff_ms + 500) / 8; 3823 1000 * timestamp_diff_ms + 500) / 8;
3968 } 3824 }
3969 } 3825 }
3970 3826
3971 void 3827 void
3972 Channel::RegisterReceiveCodecsToRTPModule() 3828 Channel::RegisterReceiveCodecsToRTPModule()
3973 { 3829 {
3974 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), 3830 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
3975 "Channel::RegisterReceiveCodecsToRTPModule()"); 3831 "Channel::RegisterReceiveCodecsToRTPModule()");
3976 3832
3977
3978 CodecInst codec; 3833 CodecInst codec;
3979 const uint8_t nSupportedCodecs = AudioCodingModule::NumberOfCodecs(); 3834 const uint8_t nSupportedCodecs = AudioCodingModule::NumberOfCodecs();
3980 3835
3981 for (int idx = 0; idx < nSupportedCodecs; idx++) 3836 for (int idx = 0; idx < nSupportedCodecs; idx++)
3982 { 3837 {
3983 // Open up the RTP/RTCP receiver for all supported codecs 3838 // Open up the RTP/RTCP receiver for all supported codecs
3984 if ((audio_coding_->Codec(idx, &codec) == -1) || 3839 if ((audio_coding_->Codec(idx, &codec) == -1) ||
3985 (rtp_receiver_->RegisterReceivePayload( 3840 (rtp_receiver_->RegisterReceivePayload(
3986 codec.plname, 3841 codec.plname,
3987 codec.pltype, 3842 codec.pltype,
3988 codec.plfreq, 3843 codec.plfreq,
3989 codec.channels, 3844 codec.channels,
3990 (codec.rate < 0) ? 0 : codec.rate) == -1)) 3845 (codec.rate < 0) ? 0 : codec.rate) == -1))
3991 { 3846 {
3992 WEBRTC_TRACE( 3847 WEBRTC_TRACE(kTraceWarning,
3993 kTraceWarning,
3994 kTraceVoice, 3848 kTraceVoice,
3995 VoEId(_instanceId, _channelId), 3849 VoEId(_instanceId, _channelId),
3996 "Channel::RegisterReceiveCodecsToRTPModule() unable" 3850 "Channel::RegisterReceiveCodecsToRTPModule() unable"
3997 " to register %s (%d/%d/%d/%d) to RTP/RTCP receiver", 3851 " to register %s (%d/%d/%d/%d) to RTP/RTCP receiver",
3998 codec.plname, codec.pltype, codec.plfreq, 3852 codec.plname, codec.pltype, codec.plfreq,
3999 codec.channels, codec.rate); 3853 codec.channels, codec.rate);
4000 } 3854 }
4001 else 3855 else
4002 { 3856 {
4003 WEBRTC_TRACE( 3857 WEBRTC_TRACE(kTraceInfo,
4004 kTraceInfo,
4005 kTraceVoice, 3858 kTraceVoice,
4006 VoEId(_instanceId, _channelId), 3859 VoEId(_instanceId, _channelId),
4007 "Channel::RegisterReceiveCodecsToRTPModule() %s " 3860 "Channel::RegisterReceiveCodecsToRTPModule() %s "
4008 "(%d/%d/%d/%d) has been added to the RTP/RTCP " 3861 "(%d/%d/%d/%d) has been added to the RTP/RTCP "
4009 "receiver", 3862 "receiver",
4010 codec.plname, codec.pltype, codec.plfreq, 3863 codec.plname, codec.pltype, codec.plfreq,
4011 codec.channels, codec.rate); 3864 codec.channels, codec.rate);
4012 } 3865 }
4013 } 3866 }
4014 } 3867 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
4127 int64_t min_rtt = 0; 3980 int64_t min_rtt = 0;
4128 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) 3981 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt)
4129 != 0) { 3982 != 0) {
4130 return 0; 3983 return 0;
4131 } 3984 }
4132 return rtt; 3985 return rtt;
4133 } 3986 }
4134 3987
4135 } // namespace voe 3988 } // namespace voe
4136 } // namespace webrtc 3989 } // namespace webrtc
OLDNEW
« no previous file with comments | « talk/media/webrtc/webrtcvoiceengine.cc ('k') | webrtc/voice_engine/transmit_mixer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698