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

Side by Side Diff: webrtc/call/call.cc

Issue 3016473002: Remove encoding code from RtcEventLogImpl and use RtcEventLogEncoder instead (Closed)
Patch Set: Created 3 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 | « no previous file | webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h » ('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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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
11 #include <string.h> 11 #include <string.h>
12 #include <algorithm> 12 #include <algorithm>
13 #include <map> 13 #include <map>
14 #include <memory> 14 #include <memory>
15 #include <set> 15 #include <set>
16 #include <utility> 16 #include <utility>
17 #include <vector> 17 #include <vector>
18 18
19 #include "webrtc/api/optional.h" 19 #include "webrtc/api/optional.h"
20 #include "webrtc/audio/audio_receive_stream.h" 20 #include "webrtc/audio/audio_receive_stream.h"
21 #include "webrtc/audio/audio_send_stream.h" 21 #include "webrtc/audio/audio_send_stream.h"
22 #include "webrtc/audio/audio_state.h" 22 #include "webrtc/audio/audio_state.h"
23 #include "webrtc/audio/scoped_voe_interface.h" 23 #include "webrtc/audio/scoped_voe_interface.h"
24 #include "webrtc/audio/time_interval.h" 24 #include "webrtc/audio/time_interval.h"
25 #include "webrtc/call/bitrate_allocator.h" 25 #include "webrtc/call/bitrate_allocator.h"
26 #include "webrtc/call/call.h" 26 #include "webrtc/call/call.h"
27 #include "webrtc/call/flexfec_receive_stream_impl.h" 27 #include "webrtc/call/flexfec_receive_stream_impl.h"
28 #include "webrtc/call/rtp_stream_receiver_controller.h" 28 #include "webrtc/call/rtp_stream_receiver_controller.h"
29 #include "webrtc/call/rtp_transport_controller_send.h" 29 #include "webrtc/call/rtp_transport_controller_send.h"
30 #include "webrtc/logging/rtc_event_log/events/rtc_event_audio_receive_stream_con fig.h"
31 #include "webrtc/logging/rtc_event_log/events/rtc_event_audio_send_stream_config .h"
32 #include "webrtc/logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.h"
33 #include "webrtc/logging/rtc_event_log/events/rtc_event_rtp_packet_incoming.h"
34 #include "webrtc/logging/rtc_event_log/events/rtc_event_video_receive_stream_con fig.h"
35 #include "webrtc/logging/rtc_event_log/events/rtc_event_video_send_stream_config .h"
30 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" 36 #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
31 #include "webrtc/logging/rtc_event_log/rtc_stream_config.h" 37 #include "webrtc/logging/rtc_event_log/rtc_stream_config.h"
32 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" 38 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
33 #include "webrtc/modules/congestion_controller/include/receive_side_congestion_c ontroller.h" 39 #include "webrtc/modules/congestion_controller/include/receive_side_congestion_c ontroller.h"
34 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h" 40 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h"
35 #include "webrtc/modules/rtp_rtcp/include/rtp_header_extension_map.h" 41 #include "webrtc/modules/rtp_rtcp/include/rtp_header_extension_map.h"
36 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" 42 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
37 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" 43 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
38 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" 44 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h"
39 #include "webrtc/modules/utility/include/process_thread.h" 45 #include "webrtc/modules/utility/include/process_thread.h"
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 608
603 PacketReceiver* Call::Receiver() { 609 PacketReceiver* Call::Receiver() {
604 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); 610 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_);
605 return this; 611 return this;
606 } 612 }
607 613
608 webrtc::AudioSendStream* Call::CreateAudioSendStream( 614 webrtc::AudioSendStream* Call::CreateAudioSendStream(
609 const webrtc::AudioSendStream::Config& config) { 615 const webrtc::AudioSendStream::Config& config) {
610 TRACE_EVENT0("webrtc", "Call::CreateAudioSendStream"); 616 TRACE_EVENT0("webrtc", "Call::CreateAudioSendStream");
611 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); 617 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_);
612 event_log_->LogAudioSendStreamConfig(*CreateRtcLogStreamConfig(config)); 618 event_log_->Log(rtc::MakeUnique<RtcEventAudioSendStreamConfig>(
619 CreateRtcLogStreamConfig(config)));
613 620
614 rtc::Optional<RtpState> suspended_rtp_state; 621 rtc::Optional<RtpState> suspended_rtp_state;
615 { 622 {
616 const auto& iter = suspended_audio_send_ssrcs_.find(config.rtp.ssrc); 623 const auto& iter = suspended_audio_send_ssrcs_.find(config.rtp.ssrc);
617 if (iter != suspended_audio_send_ssrcs_.end()) { 624 if (iter != suspended_audio_send_ssrcs_.end()) {
618 suspended_rtp_state.emplace(iter->second); 625 suspended_rtp_state.emplace(iter->second);
619 } 626 }
620 } 627 }
621 628
622 AudioSendStream* send_stream = new AudioSendStream( 629 AudioSendStream* send_stream = new AudioSendStream(
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 } 675 }
669 UpdateAggregateNetworkState(); 676 UpdateAggregateNetworkState();
670 sent_rtp_audio_timer_ms_.Extend(audio_send_stream->GetActiveLifetime()); 677 sent_rtp_audio_timer_ms_.Extend(audio_send_stream->GetActiveLifetime());
671 delete send_stream; 678 delete send_stream;
672 } 679 }
673 680
674 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( 681 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream(
675 const webrtc::AudioReceiveStream::Config& config) { 682 const webrtc::AudioReceiveStream::Config& config) {
676 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); 683 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream");
677 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); 684 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_);
678 event_log_->LogAudioReceiveStreamConfig(*CreateRtcLogStreamConfig(config)); 685 event_log_->Log(rtc::MakeUnique<RtcEventAudioReceiveStreamConfig>(
686 CreateRtcLogStreamConfig(config)));
679 AudioReceiveStream* receive_stream = new AudioReceiveStream( 687 AudioReceiveStream* receive_stream = new AudioReceiveStream(
680 &audio_receiver_controller_, transport_send_->packet_router(), config, 688 &audio_receiver_controller_, transport_send_->packet_router(), config,
681 config_.audio_state, event_log_); 689 config_.audio_state, event_log_);
682 { 690 {
683 WriteLockScoped write_lock(*receive_crit_); 691 WriteLockScoped write_lock(*receive_crit_);
684 receive_rtp_config_[config.rtp.remote_ssrc] = 692 receive_rtp_config_[config.rtp.remote_ssrc] =
685 ReceiveRtpConfig(config.rtp.extensions, UseSendSideBwe(config)); 693 ReceiveRtpConfig(config.rtp.extensions, UseSendSideBwe(config));
686 audio_receive_streams_.insert(receive_stream); 694 audio_receive_streams_.insert(receive_stream);
687 695
688 ConfigureSync(config.sync_group); 696 ConfigureSync(config.sync_group);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 736
729 webrtc::VideoSendStream* Call::CreateVideoSendStream( 737 webrtc::VideoSendStream* Call::CreateVideoSendStream(
730 webrtc::VideoSendStream::Config config, 738 webrtc::VideoSendStream::Config config,
731 VideoEncoderConfig encoder_config) { 739 VideoEncoderConfig encoder_config) {
732 TRACE_EVENT0("webrtc", "Call::CreateVideoSendStream"); 740 TRACE_EVENT0("webrtc", "Call::CreateVideoSendStream");
733 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); 741 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_);
734 742
735 video_send_delay_stats_->AddSsrcs(config); 743 video_send_delay_stats_->AddSsrcs(config);
736 for (size_t ssrc_index = 0; ssrc_index < config.rtp.ssrcs.size(); 744 for (size_t ssrc_index = 0; ssrc_index < config.rtp.ssrcs.size();
737 ++ssrc_index) { 745 ++ssrc_index) {
738 event_log_->LogVideoSendStreamConfig( 746 event_log_->Log(rtc::MakeUnique<RtcEventVideoSendStreamConfig>(
739 *CreateRtcLogStreamConfig(config, ssrc_index)); 747 CreateRtcLogStreamConfig(config, ssrc_index)));
740 } 748 }
741 749
742 // TODO(mflodman): Base the start bitrate on a current bandwidth estimate, if 750 // TODO(mflodman): Base the start bitrate on a current bandwidth estimate, if
743 // the call has already started. 751 // the call has already started.
744 // Copy ssrcs from |config| since |config| is moved. 752 // Copy ssrcs from |config| since |config| is moved.
745 std::vector<uint32_t> ssrcs = config.rtp.ssrcs; 753 std::vector<uint32_t> ssrcs = config.rtp.ssrcs;
746 VideoSendStream* send_stream = new VideoSendStream( 754 VideoSendStream* send_stream = new VideoSendStream(
747 num_cpu_cores_, module_process_thread_.get(), &worker_queue_, 755 num_cpu_cores_, module_process_thread_.get(), &worker_queue_,
748 call_stats_.get(), transport_send_.get(), bitrate_allocator_.get(), 756 call_stats_.get(), transport_send_.get(), bitrate_allocator_.get(),
749 video_send_delay_stats_.get(), event_log_, std::move(config), 757 video_send_delay_stats_.get(), event_log_, std::move(config),
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 // type, we may get an incorrect value for the rtx stream, but 827 // type, we may get an incorrect value for the rtx stream, but
820 // that is unlikely to matter in practice. 828 // that is unlikely to matter in practice.
821 receive_rtp_config_[config.rtp.rtx_ssrc] = receive_config; 829 receive_rtp_config_[config.rtp.rtx_ssrc] = receive_config;
822 } 830 }
823 receive_rtp_config_[config.rtp.remote_ssrc] = receive_config; 831 receive_rtp_config_[config.rtp.remote_ssrc] = receive_config;
824 video_receive_streams_.insert(receive_stream); 832 video_receive_streams_.insert(receive_stream);
825 ConfigureSync(config.sync_group); 833 ConfigureSync(config.sync_group);
826 } 834 }
827 receive_stream->SignalNetworkState(video_network_state_); 835 receive_stream->SignalNetworkState(video_network_state_);
828 UpdateAggregateNetworkState(); 836 UpdateAggregateNetworkState();
829 event_log_->LogVideoReceiveStreamConfig(*CreateRtcLogStreamConfig(config)); 837 event_log_->Log(rtc::MakeUnique<RtcEventVideoReceiveStreamConfig>(
838 CreateRtcLogStreamConfig(config)));
830 return receive_stream; 839 return receive_stream;
831 } 840 }
832 841
833 void Call::DestroyVideoReceiveStream( 842 void Call::DestroyVideoReceiveStream(
834 webrtc::VideoReceiveStream* receive_stream) { 843 webrtc::VideoReceiveStream* receive_stream) {
835 TRACE_EVENT0("webrtc", "Call::DestroyVideoReceiveStream"); 844 TRACE_EVENT0("webrtc", "Call::DestroyVideoReceiveStream");
836 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); 845 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_);
837 RTC_DCHECK(receive_stream != nullptr); 846 RTC_DCHECK(receive_stream != nullptr);
838 VideoReceiveStream* receive_stream_impl = 847 VideoReceiveStream* receive_stream_impl =
839 static_cast<VideoReceiveStream*>(receive_stream); 848 static_cast<VideoReceiveStream*>(receive_stream);
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 } 1304 }
1296 } 1305 }
1297 if (media_type == MediaType::ANY || media_type == MediaType::AUDIO) { 1306 if (media_type == MediaType::ANY || media_type == MediaType::AUDIO) {
1298 ReadLockScoped read_lock(*send_crit_); 1307 ReadLockScoped read_lock(*send_crit_);
1299 for (auto& kv : audio_send_ssrcs_) { 1308 for (auto& kv : audio_send_ssrcs_) {
1300 if (kv.second->DeliverRtcp(packet, length)) 1309 if (kv.second->DeliverRtcp(packet, length))
1301 rtcp_delivered = true; 1310 rtcp_delivered = true;
1302 } 1311 }
1303 } 1312 }
1304 1313
1305 if (rtcp_delivered) 1314 if (rtcp_delivered) {
1306 event_log_->LogIncomingRtcpPacket(rtc::MakeArrayView(packet, length)); 1315 event_log_->Log(rtc::MakeUnique<RtcEventRtcpPacketIncoming>(
1316 rtc::MakeArrayView(packet, length)));
1317 }
1307 1318
1308 return rtcp_delivered ? DELIVERY_OK : DELIVERY_PACKET_ERROR; 1319 return rtcp_delivered ? DELIVERY_OK : DELIVERY_PACKET_ERROR;
1309 } 1320 }
1310 1321
1311 PacketReceiver::DeliveryStatus Call::DeliverRtp(MediaType media_type, 1322 PacketReceiver::DeliveryStatus Call::DeliverRtp(MediaType media_type,
1312 const uint8_t* packet, 1323 const uint8_t* packet,
1313 size_t length, 1324 size_t length,
1314 const PacketTime& packet_time) { 1325 const PacketTime& packet_time) {
1315 TRACE_EVENT0("webrtc", "Call::DeliverRtp"); 1326 TRACE_EVENT0("webrtc", "Call::DeliverRtp");
1316 1327
(...skipping 28 matching lines...) Expand all
1345 return DELIVERY_UNKNOWN_SSRC; 1356 return DELIVERY_UNKNOWN_SSRC;
1346 } 1357 }
1347 parsed_packet->IdentifyExtensions(it->second.extensions); 1358 parsed_packet->IdentifyExtensions(it->second.extensions);
1348 1359
1349 NotifyBweOfReceivedPacket(*parsed_packet, media_type); 1360 NotifyBweOfReceivedPacket(*parsed_packet, media_type);
1350 1361
1351 if (media_type == MediaType::AUDIO) { 1362 if (media_type == MediaType::AUDIO) {
1352 if (audio_receiver_controller_.OnRtpPacket(*parsed_packet)) { 1363 if (audio_receiver_controller_.OnRtpPacket(*parsed_packet)) {
1353 received_bytes_per_second_counter_.Add(static_cast<int>(length)); 1364 received_bytes_per_second_counter_.Add(static_cast<int>(length));
1354 received_audio_bytes_per_second_counter_.Add(static_cast<int>(length)); 1365 received_audio_bytes_per_second_counter_.Add(static_cast<int>(length));
1355 event_log_->LogIncomingRtpHeader(*parsed_packet); 1366 event_log_->Log(
1367 rtc::MakeUnique<RtcEventRtpPacketIncoming>(*parsed_packet));
1356 const int64_t arrival_time_ms = parsed_packet->arrival_time_ms(); 1368 const int64_t arrival_time_ms = parsed_packet->arrival_time_ms();
1357 if (!first_received_rtp_audio_ms_) { 1369 if (!first_received_rtp_audio_ms_) {
1358 first_received_rtp_audio_ms_.emplace(arrival_time_ms); 1370 first_received_rtp_audio_ms_.emplace(arrival_time_ms);
1359 } 1371 }
1360 last_received_rtp_audio_ms_.emplace(arrival_time_ms); 1372 last_received_rtp_audio_ms_.emplace(arrival_time_ms);
1361 return DELIVERY_OK; 1373 return DELIVERY_OK;
1362 } 1374 }
1363 } else if (media_type == MediaType::VIDEO) { 1375 } else if (media_type == MediaType::VIDEO) {
1364 if (video_receiver_controller_.OnRtpPacket(*parsed_packet)) { 1376 if (video_receiver_controller_.OnRtpPacket(*parsed_packet)) {
1365 received_bytes_per_second_counter_.Add(static_cast<int>(length)); 1377 received_bytes_per_second_counter_.Add(static_cast<int>(length));
1366 received_video_bytes_per_second_counter_.Add(static_cast<int>(length)); 1378 received_video_bytes_per_second_counter_.Add(static_cast<int>(length));
1367 event_log_->LogIncomingRtpHeader(*parsed_packet); 1379 event_log_->Log(
1380 rtc::MakeUnique<RtcEventRtpPacketIncoming>(*parsed_packet));
1368 const int64_t arrival_time_ms = parsed_packet->arrival_time_ms(); 1381 const int64_t arrival_time_ms = parsed_packet->arrival_time_ms();
1369 if (!first_received_rtp_video_ms_) { 1382 if (!first_received_rtp_video_ms_) {
1370 first_received_rtp_video_ms_.emplace(arrival_time_ms); 1383 first_received_rtp_video_ms_.emplace(arrival_time_ms);
1371 } 1384 }
1372 last_received_rtp_video_ms_.emplace(arrival_time_ms); 1385 last_received_rtp_video_ms_.emplace(arrival_time_ms);
1373 return DELIVERY_OK; 1386 return DELIVERY_OK;
1374 } 1387 }
1375 } 1388 }
1376 return DELIVERY_UNKNOWN_SSRC; 1389 return DELIVERY_UNKNOWN_SSRC;
1377 } 1390 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { 1452 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) {
1440 receive_side_cc_.OnReceivedPacket( 1453 receive_side_cc_.OnReceivedPacket(
1441 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), 1454 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(),
1442 header); 1455 header);
1443 } 1456 }
1444 } 1457 }
1445 1458
1446 } // namespace internal 1459 } // namespace internal
1447 1460
1448 } // namespace webrtc 1461 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698