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

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

Issue 2644863002: Reland of "Log audio network adapter decisions in event log." (Closed)
Patch Set: rebase Created 3 years, 11 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 LogAudioNetworkAdaptation(
81 const AudioNetworkAdaptor::EncoderRuntimeConfig& config) override;
80 82
81 private: 83 private:
82 void StoreEvent(std::unique_ptr<rtclog::Event>* event); 84 void StoreEvent(std::unique_ptr<rtclog::Event>* event);
83 85
84 // Message queue for passing control messages to the logging thread. 86 // Message queue for passing control messages to the logging thread.
85 SwapQueue<RtcEventLogHelperThread::ControlMessage> message_queue_; 87 SwapQueue<RtcEventLogHelperThread::ControlMessage> message_queue_;
86 88
87 // Message queue for passing events to the logging thread. 89 // Message queue for passing events to the logging thread.
88 SwapQueue<std::unique_ptr<rtclog::Event> > event_queue_; 90 SwapQueue<std::unique_ptr<rtclog::Event> > event_queue_;
89 91
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 std::unique_ptr<rtclog::Event> event(new rtclog::Event()); 429 std::unique_ptr<rtclog::Event> event(new rtclog::Event());
428 event->set_timestamp_us(rtc::TimeMicros()); 430 event->set_timestamp_us(rtc::TimeMicros());
429 event->set_type(rtclog::Event::BWE_PACKET_LOSS_EVENT); 431 event->set_type(rtclog::Event::BWE_PACKET_LOSS_EVENT);
430 auto bwe_event = event->mutable_bwe_packet_loss_event(); 432 auto bwe_event = event->mutable_bwe_packet_loss_event();
431 bwe_event->set_bitrate(bitrate); 433 bwe_event->set_bitrate(bitrate);
432 bwe_event->set_fraction_loss(fraction_loss); 434 bwe_event->set_fraction_loss(fraction_loss);
433 bwe_event->set_total_packets(total_packets); 435 bwe_event->set_total_packets(total_packets);
434 StoreEvent(&event); 436 StoreEvent(&event);
435 } 437 }
436 438
439 void RtcEventLogImpl::LogAudioNetworkAdaptation(
440 const AudioNetworkAdaptor::EncoderRuntimeConfig& config) {
441 std::unique_ptr<rtclog::Event> event(new rtclog::Event());
442 event->set_timestamp_us(rtc::TimeMicros());
443 event->set_type(rtclog::Event::AUDIO_NETWORK_ADAPTATION_EVENT);
444 auto audio_network_adaptation = event->mutable_audio_network_adaptation();
445 if (config.bitrate_bps)
446 audio_network_adaptation->set_bitrate_bps(*config.bitrate_bps);
447 if (config.frame_length_ms)
448 audio_network_adaptation->set_frame_length_ms(*config.frame_length_ms);
449 if (config.uplink_packet_loss_fraction) {
450 audio_network_adaptation->set_uplink_packet_loss_fraction(
451 *config.uplink_packet_loss_fraction);
452 }
453 if (config.enable_fec)
454 audio_network_adaptation->set_enable_fec(*config.enable_fec);
455 if (config.enable_dtx)
456 audio_network_adaptation->set_enable_dtx(*config.enable_dtx);
457 if (config.num_channels)
458 audio_network_adaptation->set_num_channels(*config.num_channels);
459 StoreEvent(&event);
460 }
461
437 void RtcEventLogImpl::StoreEvent(std::unique_ptr<rtclog::Event>* event) { 462 void RtcEventLogImpl::StoreEvent(std::unique_ptr<rtclog::Event>* event) {
438 if (!event_queue_.Insert(event)) { 463 if (!event_queue_.Insert(event)) {
439 LOG(LS_ERROR) << "WebRTC event log queue full. Dropping event."; 464 LOG(LS_ERROR) << "WebRTC event log queue full. Dropping event.";
440 } 465 }
441 helper_thread_.SignalNewEvent(); 466 helper_thread_.SignalNewEvent();
442 } 467 }
443 468
444 bool RtcEventLog::ParseRtcEventLog(const std::string& file_name, 469 bool RtcEventLog::ParseRtcEventLog(const std::string& file_name,
445 rtclog::EventStream* result) { 470 rtclog::EventStream* result) {
446 char tmp_buffer[1024]; 471 char tmp_buffer[1024];
(...skipping 28 matching lines...) Expand all
475 #else 500 #else
476 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); 501 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl());
477 #endif // ENABLE_RTC_EVENT_LOG 502 #endif // ENABLE_RTC_EVENT_LOG
478 } 503 }
479 504
480 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() { 505 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() {
481 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); 506 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl());
482 } 507 }
483 508
484 } // namespace webrtc 509 } // 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