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

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

Issue 2559953002: Log audio network adapter decisions in event log. (Closed)
Patch Set: Response to comments Created 3 years, 12 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
11 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" 11 #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
12 12
13 #include <limits> 13 #include <limits>
14 #include <vector> 14 #include <vector>
15 15
16 #include "webrtc/base/checks.h" 16 #include "webrtc/base/checks.h"
17 #include "webrtc/base/constructormagic.h" 17 #include "webrtc/base/constructormagic.h"
18 #include "webrtc/base/event.h" 18 #include "webrtc/base/event.h"
19 #include "webrtc/base/swap_queue.h" 19 #include "webrtc/base/swap_queue.h"
20 #include "webrtc/base/thread_checker.h" 20 #include "webrtc/base/thread_checker.h"
21 #include "webrtc/call.h" 21 #include "webrtc/call.h"
22 #include "webrtc/logging/rtc_event_log/rtc_event_log_helper_thread.h" 22 #include "webrtc/logging/rtc_event_log/rtc_event_log_helper_thread.h"
23 #include "webrtc/modules/audio_coding/audio_network_adaptor/debug_dump_writer.h"
23 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 24 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
24 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" 25 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
25 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h" 26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h"
26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h" 27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h"
27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h" 28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h"
28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report.h" 29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report.h"
29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.h" 30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.h"
30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" 31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h"
31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/psfb.h" 32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/psfb.h"
32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rtpfb.h" 33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rtpfb.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 const uint8_t* header, 71 const uint8_t* header,
71 size_t packet_length) override; 72 size_t packet_length) override;
72 void LogRtcpPacket(PacketDirection direction, 73 void LogRtcpPacket(PacketDirection direction,
73 MediaType media_type, 74 MediaType media_type,
74 const uint8_t* packet, 75 const uint8_t* packet,
75 size_t length) override; 76 size_t length) override;
76 void LogAudioPlayout(uint32_t ssrc) override; 77 void LogAudioPlayout(uint32_t ssrc) override;
77 void LogBwePacketLossEvent(int32_t bitrate, 78 void LogBwePacketLossEvent(int32_t bitrate,
78 uint8_t fraction_loss, 79 uint8_t fraction_loss,
79 int32_t total_packets) override; 80 int32_t total_packets) override;
81 void LogAudioEncoderConfig(
82 const AudioNetworkAdaptor::EncoderRuntimeConfig& config) override;
80 83
81 private: 84 private:
82 void StoreEvent(std::unique_ptr<rtclog::Event>* event); 85 void StoreEvent(std::unique_ptr<rtclog::Event>* event);
83 86
84 // Message queue for passing control messages to the logging thread. 87 // Message queue for passing control messages to the logging thread.
85 SwapQueue<RtcEventLogHelperThread::ControlMessage> message_queue_; 88 SwapQueue<RtcEventLogHelperThread::ControlMessage> message_queue_;
86 89
87 // Message queue for passing events to the logging thread. 90 // Message queue for passing events to the logging thread.
88 SwapQueue<std::unique_ptr<rtclog::Event> > event_queue_; 91 SwapQueue<std::unique_ptr<rtclog::Event> > event_queue_;
89 92
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 std::unique_ptr<rtclog::Event> event(new rtclog::Event()); 433 std::unique_ptr<rtclog::Event> event(new rtclog::Event());
431 event->set_timestamp_us(clock_->TimeInMicroseconds()); 434 event->set_timestamp_us(clock_->TimeInMicroseconds());
432 event->set_type(rtclog::Event::BWE_PACKET_LOSS_EVENT); 435 event->set_type(rtclog::Event::BWE_PACKET_LOSS_EVENT);
433 auto bwe_event = event->mutable_bwe_packet_loss_event(); 436 auto bwe_event = event->mutable_bwe_packet_loss_event();
434 bwe_event->set_bitrate(bitrate); 437 bwe_event->set_bitrate(bitrate);
435 bwe_event->set_fraction_loss(fraction_loss); 438 bwe_event->set_fraction_loss(fraction_loss);
436 bwe_event->set_total_packets(total_packets); 439 bwe_event->set_total_packets(total_packets);
437 StoreEvent(&event); 440 StoreEvent(&event);
438 } 441 }
439 442
443 void RtcEventLogImpl::LogAudioEncoderConfig(
444 const AudioNetworkAdaptor::EncoderRuntimeConfig& config) {
445 std::unique_ptr<rtclog::Event> event(new rtclog::Event());
446 event->set_timestamp_us(clock_->TimeInMicroseconds());
447 event->set_type(rtclog::Event::AUDIO_ENCODER_CONFIG_EVENT);
448 DebugDumpWriter::ConvertEncoderConfigToDumpEntry(
449 config, event->mutable_encoder_config());
450 StoreEvent(&event);
451 }
452
440 void RtcEventLogImpl::StoreEvent(std::unique_ptr<rtclog::Event>* event) { 453 void RtcEventLogImpl::StoreEvent(std::unique_ptr<rtclog::Event>* event) {
441 if (!event_queue_.Insert(event)) { 454 if (!event_queue_.Insert(event)) {
442 LOG(LS_ERROR) << "WebRTC event log queue full. Dropping event."; 455 LOG(LS_ERROR) << "WebRTC event log queue full. Dropping event.";
443 } 456 }
444 helper_thread_.SignalNewEvent(); 457 helper_thread_.SignalNewEvent();
445 } 458 }
446 459
447 bool RtcEventLog::ParseRtcEventLog(const std::string& file_name, 460 bool RtcEventLog::ParseRtcEventLog(const std::string& file_name,
448 rtclog::EventStream* result) { 461 rtclog::EventStream* result) {
449 char tmp_buffer[1024]; 462 char tmp_buffer[1024];
(...skipping 28 matching lines...) Expand all
478 #else 491 #else
479 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); 492 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl());
480 #endif // ENABLE_RTC_EVENT_LOG 493 #endif // ENABLE_RTC_EVENT_LOG
481 } 494 }
482 495
483 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() { 496 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() {
484 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); 497 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl());
485 } 498 }
486 499
487 } // namespace webrtc 500 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698