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

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

Issue 1748403002: Move RtcEventLog object from inside VoiceEngine to Call. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Introduce proxy object for RtcEventLog and handle other comments. Created 4 years, 9 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
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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 return false; 487 return false;
488 } 488 }
489 header.payload_type_frequency = 489 header.payload_type_frequency =
490 rtp_payload_registry_->GetPayloadTypeFrequency(header.payloadType); 490 rtp_payload_registry_->GetPayloadTypeFrequency(header.payloadType);
491 if (header.payload_type_frequency < 0) 491 if (header.payload_type_frequency < 0)
492 return false; 492 return false;
493 return ReceivePacket(rtp_packet, rtp_packet_length, header, false); 493 return ReceivePacket(rtp_packet, rtp_packet_length, header, false);
494 } 494 }
495 495
496 int32_t Channel::GetAudioFrame(int32_t id, AudioFrame* audioFrame) { 496 int32_t Channel::GetAudioFrame(int32_t id, AudioFrame* audioFrame) {
497 if (event_log_) { 497 unsigned int ssrc;
498 unsigned int ssrc; 498 RTC_CHECK_EQ(GetLocalSSRC(ssrc), 0);
499 RTC_CHECK_EQ(GetLocalSSRC(ssrc), 0); 499 event_log_.LogAudioPlayout(ssrc);
500 event_log_->LogAudioPlayout(ssrc);
501 }
502 // Get 10ms raw PCM data from the ACM (mixer limits output frequency) 500 // Get 10ms raw PCM data from the ACM (mixer limits output frequency)
503 if (audio_coding_->PlayoutData10Ms(audioFrame->sample_rate_hz_, audioFrame) == 501 if (audio_coding_->PlayoutData10Ms(audioFrame->sample_rate_hz_, audioFrame) ==
504 -1) { 502 -1) {
505 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId, _channelId), 503 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId, _channelId),
506 "Channel::GetAudioFrame() PlayoutData10Ms() failed!"); 504 "Channel::GetAudioFrame() PlayoutData10Ms() failed!");
507 // In all likelihood, the audio in this frame is garbage. We return an 505 // In all likelihood, the audio in this frame is garbage. We return an
508 // error so that the audio mixer module doesn't add it to the mix. As 506 // error so that the audio mixer module doesn't add it to the mix. As
509 // a result, it won't be played out and the actions skipped here are 507 // a result, it won't be played out and the actions skipped here are
510 // irrelevant. 508 // irrelevant.
511 return -1; 509 return -1;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 } 665 }
668 } 666 }
669 } 667 }
670 668
671 return (highestNeeded); 669 return (highestNeeded);
672 } 670 }
673 671
674 int32_t Channel::CreateChannel(Channel*& channel, 672 int32_t Channel::CreateChannel(Channel*& channel,
675 int32_t channelId, 673 int32_t channelId,
676 uint32_t instanceId, 674 uint32_t instanceId,
677 RtcEventLog* const event_log,
678 const Config& config) { 675 const Config& config) {
679 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, channelId), 676 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, channelId),
680 "Channel::CreateChannel(channelId=%d, instanceId=%d)", channelId, 677 "Channel::CreateChannel(channelId=%d, instanceId=%d)", channelId,
681 instanceId); 678 instanceId);
682 679
683 channel = new Channel(channelId, instanceId, event_log, config); 680 channel = new Channel(channelId, instanceId, config);
684 if (channel == NULL) { 681 if (channel == NULL) {
685 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, channelId), 682 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, channelId),
686 "Channel::CreateChannel() unable to allocate memory for" 683 "Channel::CreateChannel() unable to allocate memory for"
687 " channel"); 684 " channel");
688 return -1; 685 return -1;
689 } 686 }
690 return 0; 687 return 0;
691 } 688 }
692 689
693 void Channel::PlayNotification(int32_t id, uint32_t durationMs) { 690 void Channel::PlayNotification(int32_t id, uint32_t durationMs) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 assert(id == _outputFileRecorderId); 727 assert(id == _outputFileRecorderId);
731 728
732 rtc::CritScope cs(&_fileCritSect); 729 rtc::CritScope cs(&_fileCritSect);
733 730
734 _outputFileRecording = false; 731 _outputFileRecording = false;
735 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId, _channelId), 732 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId, _channelId),
736 "Channel::RecordFileEnded() => output file recorder module is" 733 "Channel::RecordFileEnded() => output file recorder module is"
737 " shutdown"); 734 " shutdown");
738 } 735 }
739 736
740 Channel::Channel(int32_t channelId, 737 Channel::Channel(int32_t channelId, uint32_t instanceId, const Config& config)
741 uint32_t instanceId,
742 RtcEventLog* const event_log,
743 const Config& config)
744 : _instanceId(instanceId), 738 : _instanceId(instanceId),
745 _channelId(channelId), 739 _channelId(channelId),
746 event_log_(event_log), 740 event_log_(),
747 rtp_header_parser_(RtpHeaderParser::Create()), 741 rtp_header_parser_(RtpHeaderParser::Create()),
748 rtp_payload_registry_( 742 rtp_payload_registry_(
749 new RTPPayloadRegistry(RTPPayloadStrategy::CreateStrategy(true))), 743 new RTPPayloadRegistry(RTPPayloadStrategy::CreateStrategy(true))),
750 rtp_receive_statistics_( 744 rtp_receive_statistics_(
751 ReceiveStatistics::Create(Clock::GetRealTimeClock())), 745 ReceiveStatistics::Create(Clock::GetRealTimeClock())),
752 rtp_receiver_( 746 rtp_receiver_(
753 RtpReceiver::CreateAudioReceiver(Clock::GetRealTimeClock(), 747 RtpReceiver::CreateAudioReceiver(Clock::GetRealTimeClock(),
754 this, 748 this,
755 this, 749 this,
756 this, 750 this,
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 configuration.outgoing_transport = this; 839 configuration.outgoing_transport = this;
846 configuration.audio_messages = this; 840 configuration.audio_messages = this;
847 configuration.receive_statistics = rtp_receive_statistics_.get(); 841 configuration.receive_statistics = rtp_receive_statistics_.get();
848 configuration.bandwidth_callback = rtcp_observer_.get(); 842 configuration.bandwidth_callback = rtcp_observer_.get();
849 if (pacing_enabled_) { 843 if (pacing_enabled_) {
850 configuration.paced_sender = rtp_packet_sender_proxy_.get(); 844 configuration.paced_sender = rtp_packet_sender_proxy_.get();
851 configuration.transport_sequence_number_allocator = 845 configuration.transport_sequence_number_allocator =
852 seq_num_allocator_proxy_.get(); 846 seq_num_allocator_proxy_.get();
853 configuration.transport_feedback_callback = feedback_observer_proxy_.get(); 847 configuration.transport_feedback_callback = feedback_observer_proxy_.get();
854 } 848 }
855 configuration.event_log = event_log; 849 configuration.event_log = &event_log_;
856 850
857 _rtpRtcpModule.reset(RtpRtcp::CreateRtpRtcp(configuration)); 851 _rtpRtcpModule.reset(RtpRtcp::CreateRtpRtcp(configuration));
858 852
859 statistics_proxy_.reset(new StatisticsProxy(_rtpRtcpModule->SSRC())); 853 statistics_proxy_.reset(new StatisticsProxy(_rtpRtcpModule->SSRC()));
860 rtp_receive_statistics_->RegisterRtcpStatisticsCallback( 854 rtp_receive_statistics_->RegisterRtcpStatisticsCallback(
861 statistics_proxy_.get()); 855 statistics_proxy_.get());
862 856
863 Config audioproc_config; 857 Config audioproc_config;
864 audioproc_config.Set<ExperimentalAgc>(new ExperimentalAgc(false)); 858 audioproc_config.Set<ExperimentalAgc>(new ExperimentalAgc(false));
865 rx_audioproc_.reset(AudioProcessing::Create(audioproc_config)); 859 rx_audioproc_.reset(AudioProcessing::Create(audioproc_config));
(...skipping 2784 matching lines...) Expand 10 before | Expand all | Expand 10 after
3650 int64_t min_rtt = 0; 3644 int64_t min_rtt = 0;
3651 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 3645 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) !=
3652 0) { 3646 0) {
3653 return 0; 3647 return 0;
3654 } 3648 }
3655 return rtt; 3649 return rtt;
3656 } 3650 }
3657 3651
3658 } // namespace voe 3652 } // namespace voe
3659 } // namespace webrtc 3653 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698