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

Side by Side Diff: webrtc/logging/rtc_event_log/rtc_event_log.cc

Issue 2695923004: Add logging of delay-based bandwidth estimate. (Closed)
Patch Set: Only log BWE update if bitrate or state has changed. Created 3 years, 10 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) 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 LogBwePacketLossEvent(int32_t bitrate,
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,
81 BandwidthUsage detector_state) override;
80 void LogAudioNetworkAdaptation( 82 void LogAudioNetworkAdaptation(
81 const AudioNetworkAdaptor::EncoderRuntimeConfig& config) override; 83 const AudioNetworkAdaptor::EncoderRuntimeConfig& config) override;
82 84
83 private: 85 private:
84 void StoreEvent(std::unique_ptr<rtclog::Event>* event); 86 void StoreEvent(std::unique_ptr<rtclog::Event>* event);
85 87
86 // Message queue for passing control messages to the logging thread. 88 // Message queue for passing control messages to the logging thread.
87 SwapQueue<RtcEventLogHelperThread::ControlMessage> message_queue_; 89 SwapQueue<RtcEventLogHelperThread::ControlMessage> message_queue_;
88 90
89 // Message queue for passing events to the logging thread. 91 // Message queue for passing events to the logging thread.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 return rtclog::MediaType::AUDIO; 124 return rtclog::MediaType::AUDIO;
123 case MediaType::VIDEO: 125 case MediaType::VIDEO:
124 return rtclog::MediaType::VIDEO; 126 return rtclog::MediaType::VIDEO;
125 case MediaType::DATA: 127 case MediaType::DATA:
126 return rtclog::MediaType::DATA; 128 return rtclog::MediaType::DATA;
127 } 129 }
128 RTC_NOTREACHED(); 130 RTC_NOTREACHED();
129 return rtclog::ANY; 131 return rtclog::ANY;
130 } 132 }
131 133
134 rtclog::BwePacketDelayEvent::DetectorState ConvertDetectorState(
135 BandwidthUsage state) {
136 switch (state) {
137 case BandwidthUsage::kBwNormal:
138 return rtclog::BwePacketDelayEvent::BWE_NORMAL;
139 case BandwidthUsage::kBwUnderusing:
140 return rtclog::BwePacketDelayEvent::BWE_UNDERUSING;
141 case BandwidthUsage::kBwOverusing:
142 return rtclog::BwePacketDelayEvent::BWE_OVERUSING;
143 }
144 RTC_NOTREACHED();
145 return rtclog::BwePacketDelayEvent::BWE_NORMAL;
146 }
147
132 // 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
133 // sent packets because they also contain received packets. 149 // sent packets because they also contain received packets.
134 static const int kEventsPerSecond = 1000; 150 static const int kEventsPerSecond = 1000;
135 static const int kControlMessagesPerSecond = 10; 151 static const int kControlMessagesPerSecond = 10;
136 } // namespace 152 } // namespace
137 153
138 // RtcEventLogImpl member functions. 154 // RtcEventLogImpl member functions.
139 RtcEventLogImpl::RtcEventLogImpl() 155 RtcEventLogImpl::RtcEventLogImpl()
140 // Allocate buffers for roughly one second of history. 156 // Allocate buffers for roughly one second of history.
141 : message_queue_(kControlMessagesPerSecond), 157 : message_queue_(kControlMessagesPerSecond),
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 std::unique_ptr<rtclog::Event> event(new rtclog::Event()); 445 std::unique_ptr<rtclog::Event> event(new rtclog::Event());
430 event->set_timestamp_us(rtc::TimeMicros()); 446 event->set_timestamp_us(rtc::TimeMicros());
431 event->set_type(rtclog::Event::BWE_PACKET_LOSS_EVENT); 447 event->set_type(rtclog::Event::BWE_PACKET_LOSS_EVENT);
432 auto bwe_event = event->mutable_bwe_packet_loss_event(); 448 auto bwe_event = event->mutable_bwe_packet_loss_event();
433 bwe_event->set_bitrate(bitrate); 449 bwe_event->set_bitrate(bitrate);
434 bwe_event->set_fraction_loss(fraction_loss); 450 bwe_event->set_fraction_loss(fraction_loss);
435 bwe_event->set_total_packets(total_packets); 451 bwe_event->set_total_packets(total_packets);
436 StoreEvent(&event); 452 StoreEvent(&event);
437 } 453 }
438 454
455 void RtcEventLogImpl::LogBwePacketDelayEvent(int32_t bitrate,
456 BandwidthUsage detector_state) {
457 std::unique_ptr<rtclog::Event> event(new rtclog::Event());
458 event->set_timestamp_us(rtc::TimeMicros());
459 event->set_type(rtclog::Event::BWE_PACKET_DELAY_EVENT);
460 auto bwe_event = event->mutable_bwe_packet_delay_event();
461 bwe_event->set_bitrate(bitrate);
462 bwe_event->set_detector_state(ConvertDetectorState(detector_state));
463 StoreEvent(&event);
464 }
465
439 void RtcEventLogImpl::LogAudioNetworkAdaptation( 466 void RtcEventLogImpl::LogAudioNetworkAdaptation(
440 const AudioNetworkAdaptor::EncoderRuntimeConfig& config) { 467 const AudioNetworkAdaptor::EncoderRuntimeConfig& config) {
441 std::unique_ptr<rtclog::Event> event(new rtclog::Event()); 468 std::unique_ptr<rtclog::Event> event(new rtclog::Event());
442 event->set_timestamp_us(rtc::TimeMicros()); 469 event->set_timestamp_us(rtc::TimeMicros());
443 event->set_type(rtclog::Event::AUDIO_NETWORK_ADAPTATION_EVENT); 470 event->set_type(rtclog::Event::AUDIO_NETWORK_ADAPTATION_EVENT);
444 auto audio_network_adaptation = event->mutable_audio_network_adaptation(); 471 auto audio_network_adaptation = event->mutable_audio_network_adaptation();
445 if (config.bitrate_bps) 472 if (config.bitrate_bps)
446 audio_network_adaptation->set_bitrate_bps(*config.bitrate_bps); 473 audio_network_adaptation->set_bitrate_bps(*config.bitrate_bps);
447 if (config.frame_length_ms) 474 if (config.frame_length_ms)
448 audio_network_adaptation->set_frame_length_ms(*config.frame_length_ms); 475 audio_network_adaptation->set_frame_length_ms(*config.frame_length_ms);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 #else 527 #else
501 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); 528 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl());
502 #endif // ENABLE_RTC_EVENT_LOG 529 #endif // ENABLE_RTC_EVENT_LOG
503 } 530 }
504 531
505 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() { 532 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() {
506 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); 533 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl());
507 } 534 }
508 535
509 } // namespace webrtc 536 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/logging/rtc_event_log/rtc_event_log.h ('k') | webrtc/logging/rtc_event_log/rtc_event_log.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698