OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 void LogAudioSendStreamConfig(const AudioSendStream::Config& config) override; | 67 void LogAudioSendStreamConfig(const AudioSendStream::Config& config) override; |
68 void LogRtpHeader(PacketDirection direction, | 68 void LogRtpHeader(PacketDirection direction, |
69 MediaType media_type, | 69 MediaType media_type, |
70 const uint8_t* header, | 70 const uint8_t* header, |
71 size_t packet_length) override; | 71 size_t packet_length) override; |
72 void LogRtcpPacket(PacketDirection direction, | 72 void LogRtcpPacket(PacketDirection direction, |
73 MediaType media_type, | 73 MediaType media_type, |
74 const uint8_t* packet, | 74 const uint8_t* packet, |
75 size_t length) override; | 75 size_t length) override; |
76 void LogAudioPlayout(uint32_t ssrc) override; | 76 void LogAudioPlayout(uint32_t ssrc) override; |
77 void LogBwePacketLossEvent(int32_t bitrate, | 77 void LogLossBasedBweUpdate(int32_t bitrate_bps, |
78 uint8_t fraction_loss, | 78 uint8_t fraction_loss, |
79 int32_t total_packets) override; | 79 int32_t total_packets) override; |
80 void LogBwePacketDelayEvent(int32_t bitrate, | 80 void LogDelayBasedBweUpdate(int32_t bitrate_bps, |
81 BandwidthUsage detector_state) override; | 81 BandwidthUsage detector_state) override; |
82 void LogAudioNetworkAdaptation( | 82 void LogAudioNetworkAdaptation( |
83 const AudioNetworkAdaptor::EncoderRuntimeConfig& config) override; | 83 const AudioNetworkAdaptor::EncoderRuntimeConfig& config) override; |
84 | 84 |
85 private: | 85 private: |
86 void StoreEvent(std::unique_ptr<rtclog::Event>* event); | 86 void StoreEvent(std::unique_ptr<rtclog::Event>* event); |
87 | 87 |
88 // Message queue for passing control messages to the logging thread. | 88 // Message queue for passing control messages to the logging thread. |
89 SwapQueue<RtcEventLogHelperThread::ControlMessage> message_queue_; | 89 SwapQueue<RtcEventLogHelperThread::ControlMessage> message_queue_; |
90 | 90 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 return rtclog::MediaType::AUDIO; | 124 return rtclog::MediaType::AUDIO; |
125 case MediaType::VIDEO: | 125 case MediaType::VIDEO: |
126 return rtclog::MediaType::VIDEO; | 126 return rtclog::MediaType::VIDEO; |
127 case MediaType::DATA: | 127 case MediaType::DATA: |
128 return rtclog::MediaType::DATA; | 128 return rtclog::MediaType::DATA; |
129 } | 129 } |
130 RTC_NOTREACHED(); | 130 RTC_NOTREACHED(); |
131 return rtclog::ANY; | 131 return rtclog::ANY; |
132 } | 132 } |
133 | 133 |
134 rtclog::BwePacketDelayEvent::DetectorState ConvertDetectorState( | 134 rtclog::DelayBasedBweUpdate::DetectorState ConvertDetectorState( |
135 BandwidthUsage state) { | 135 BandwidthUsage state) { |
136 switch (state) { | 136 switch (state) { |
137 case BandwidthUsage::kBwNormal: | 137 case BandwidthUsage::kBwNormal: |
138 return rtclog::BwePacketDelayEvent::BWE_NORMAL; | 138 return rtclog::DelayBasedBweUpdate::BWE_NORMAL; |
139 case BandwidthUsage::kBwUnderusing: | 139 case BandwidthUsage::kBwUnderusing: |
140 return rtclog::BwePacketDelayEvent::BWE_UNDERUSING; | 140 return rtclog::DelayBasedBweUpdate::BWE_UNDERUSING; |
141 case BandwidthUsage::kBwOverusing: | 141 case BandwidthUsage::kBwOverusing: |
142 return rtclog::BwePacketDelayEvent::BWE_OVERUSING; | 142 return rtclog::DelayBasedBweUpdate::BWE_OVERUSING; |
143 } | 143 } |
144 RTC_NOTREACHED(); | 144 RTC_NOTREACHED(); |
145 return rtclog::BwePacketDelayEvent::BWE_NORMAL; | 145 return rtclog::DelayBasedBweUpdate::BWE_NORMAL; |
146 } | 146 } |
147 | 147 |
148 // The RTP and RTCP buffers reserve space for twice the expected number of | 148 // The RTP and RTCP buffers reserve space for twice the expected number of |
149 // sent packets because they also contain received packets. | 149 // sent packets because they also contain received packets. |
150 static const int kEventsPerSecond = 1000; | 150 static const int kEventsPerSecond = 1000; |
151 static const int kControlMessagesPerSecond = 10; | 151 static const int kControlMessagesPerSecond = 10; |
152 } // namespace | 152 } // namespace |
153 | 153 |
154 // RtcEventLogImpl member functions. | 154 // RtcEventLogImpl member functions. |
155 RtcEventLogImpl::RtcEventLogImpl() | 155 RtcEventLogImpl::RtcEventLogImpl() |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 | 432 |
433 void RtcEventLogImpl::LogAudioPlayout(uint32_t ssrc) { | 433 void RtcEventLogImpl::LogAudioPlayout(uint32_t ssrc) { |
434 std::unique_ptr<rtclog::Event> event(new rtclog::Event()); | 434 std::unique_ptr<rtclog::Event> event(new rtclog::Event()); |
435 event->set_timestamp_us(rtc::TimeMicros()); | 435 event->set_timestamp_us(rtc::TimeMicros()); |
436 event->set_type(rtclog::Event::AUDIO_PLAYOUT_EVENT); | 436 event->set_type(rtclog::Event::AUDIO_PLAYOUT_EVENT); |
437 auto playout_event = event->mutable_audio_playout_event(); | 437 auto playout_event = event->mutable_audio_playout_event(); |
438 playout_event->set_local_ssrc(ssrc); | 438 playout_event->set_local_ssrc(ssrc); |
439 StoreEvent(&event); | 439 StoreEvent(&event); |
440 } | 440 } |
441 | 441 |
442 void RtcEventLogImpl::LogBwePacketLossEvent(int32_t bitrate, | 442 void RtcEventLogImpl::LogLossBasedBweUpdate(int32_t bitrate_bps, |
443 uint8_t fraction_loss, | 443 uint8_t fraction_loss, |
444 int32_t total_packets) { | 444 int32_t total_packets) { |
445 std::unique_ptr<rtclog::Event> event(new rtclog::Event()); | 445 std::unique_ptr<rtclog::Event> event(new rtclog::Event()); |
446 event->set_timestamp_us(rtc::TimeMicros()); | 446 event->set_timestamp_us(rtc::TimeMicros()); |
447 event->set_type(rtclog::Event::BWE_PACKET_LOSS_EVENT); | 447 event->set_type(rtclog::Event::LOSS_BASED_BWE_UPDATE); |
448 auto bwe_event = event->mutable_bwe_packet_loss_event(); | 448 auto bwe_event = event->mutable_loss_based_bwe_update(); |
449 bwe_event->set_bitrate(bitrate); | 449 bwe_event->set_bitrate_bps(bitrate_bps); |
450 bwe_event->set_fraction_loss(fraction_loss); | 450 bwe_event->set_fraction_loss(fraction_loss); |
451 bwe_event->set_total_packets(total_packets); | 451 bwe_event->set_total_packets(total_packets); |
452 StoreEvent(&event); | 452 StoreEvent(&event); |
453 } | 453 } |
454 | 454 |
455 void RtcEventLogImpl::LogBwePacketDelayEvent(int32_t bitrate, | 455 void RtcEventLogImpl::LogDelayBasedBweUpdate(int32_t bitrate_bps, |
456 BandwidthUsage detector_state) { | 456 BandwidthUsage detector_state) { |
457 std::unique_ptr<rtclog::Event> event(new rtclog::Event()); | 457 std::unique_ptr<rtclog::Event> event(new rtclog::Event()); |
458 event->set_timestamp_us(rtc::TimeMicros()); | 458 event->set_timestamp_us(rtc::TimeMicros()); |
459 event->set_type(rtclog::Event::BWE_PACKET_DELAY_EVENT); | 459 event->set_type(rtclog::Event::DELAY_BASED_BWE_UPDATE); |
460 auto bwe_event = event->mutable_bwe_packet_delay_event(); | 460 auto bwe_event = event->mutable_delay_based_bwe_update(); |
461 bwe_event->set_bitrate(bitrate); | 461 bwe_event->set_bitrate_bps(bitrate_bps); |
462 bwe_event->set_detector_state(ConvertDetectorState(detector_state)); | 462 bwe_event->set_detector_state(ConvertDetectorState(detector_state)); |
463 StoreEvent(&event); | 463 StoreEvent(&event); |
464 } | 464 } |
465 | 465 |
466 void RtcEventLogImpl::LogAudioNetworkAdaptation( | 466 void RtcEventLogImpl::LogAudioNetworkAdaptation( |
467 const AudioNetworkAdaptor::EncoderRuntimeConfig& config) { | 467 const AudioNetworkAdaptor::EncoderRuntimeConfig& config) { |
468 std::unique_ptr<rtclog::Event> event(new rtclog::Event()); | 468 std::unique_ptr<rtclog::Event> event(new rtclog::Event()); |
469 event->set_timestamp_us(rtc::TimeMicros()); | 469 event->set_timestamp_us(rtc::TimeMicros()); |
470 event->set_type(rtclog::Event::AUDIO_NETWORK_ADAPTATION_EVENT); | 470 event->set_type(rtclog::Event::AUDIO_NETWORK_ADAPTATION_EVENT); |
471 auto audio_network_adaptation = event->mutable_audio_network_adaptation(); | 471 auto audio_network_adaptation = event->mutable_audio_network_adaptation(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 #else | 527 #else |
528 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); | 528 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); |
529 #endif // ENABLE_RTC_EVENT_LOG | 529 #endif // ENABLE_RTC_EVENT_LOG |
530 } | 530 } |
531 | 531 |
532 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() { | 532 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() { |
533 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); | 533 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); |
534 } | 534 } |
535 | 535 |
536 } // namespace webrtc | 536 } // namespace webrtc |
OLD | NEW |