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

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

Issue 2997883002: Video/Screenshare loopback tool.
Patch Set: Rebase 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
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 BandwidthUsage detector_state) override; 86 BandwidthUsage detector_state) override;
87 void LogAudioNetworkAdaptation( 87 void LogAudioNetworkAdaptation(
88 const AudioEncoderRuntimeConfig& config) override; 88 const AudioEncoderRuntimeConfig& config) override;
89 void LogProbeClusterCreated(int id, 89 void LogProbeClusterCreated(int id,
90 int bitrate_bps, 90 int bitrate_bps,
91 int min_probes, 91 int min_probes,
92 int min_bytes) override; 92 int min_bytes) override;
93 void LogProbeResultSuccess(int id, int bitrate_bps) override; 93 void LogProbeResultSuccess(int id, int bitrate_bps) override;
94 void LogProbeResultFailure(int id, 94 void LogProbeResultFailure(int id,
95 ProbeFailureReason failure_reason) override; 95 ProbeFailureReason failure_reason) override;
96 void LogAckedBitrate(uint32_t bitrate_bps) override;
97 void LogAlrState(bool in_alr, uint32_t bitrate_bps) override;
98 void LogPacketQueueTime(uint32_t ssrc, int64_t time_ms) override;
96 99
97 private: 100 private:
98 // Private constructor to ensure that creation is done by RtcEventLog::Create. 101 // Private constructor to ensure that creation is done by RtcEventLog::Create.
99 RtcEventLogImpl(); 102 RtcEventLogImpl();
100 103
101 void StoreEvent(std::unique_ptr<rtclog::Event> event); 104 void StoreEvent(std::unique_ptr<rtclog::Event> event);
102 void LogProbeResult(int id, 105 void LogProbeResult(int id,
103 rtclog::BweProbeResult::ResultType result, 106 rtclog::BweProbeResult::ResultType result,
104 int bitrate_bps); 107 int bitrate_bps);
105 108
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 event->set_type(rtclog::Event::BWE_PROBE_RESULT_EVENT); 561 event->set_type(rtclog::Event::BWE_PROBE_RESULT_EVENT);
559 562
560 auto probe_result = event->mutable_probe_result(); 563 auto probe_result = event->mutable_probe_result();
561 probe_result->set_id(id); 564 probe_result->set_id(id);
562 probe_result->set_result(result); 565 probe_result->set_result(result);
563 if (result == rtclog::BweProbeResult::SUCCESS) 566 if (result == rtclog::BweProbeResult::SUCCESS)
564 probe_result->set_bitrate_bps(bitrate_bps); 567 probe_result->set_bitrate_bps(bitrate_bps);
565 StoreEvent(std::move(event)); 568 StoreEvent(std::move(event));
566 } 569 }
567 570
571 void RtcEventLogImpl::LogAckedBitrate(uint32_t bitrate_bps) {
572 std::unique_ptr<rtclog::Event> event(new rtclog::Event());
573 event->set_timestamp_us(rtc::TimeMicros());
574 event->set_type(rtclog::Event::BWE_ACKED_BITRATE_EVENT);
575
576 auto acked_bitrate = event->mutable_acked_bitrate();
577 acked_bitrate->set_bitrate_bps(bitrate_bps);
578 StoreEvent(std::move(event));
579 }
580
581 void RtcEventLogImpl::LogAlrState(bool in_alr, uint32_t usage_bps) {
582 std::unique_ptr<rtclog::Event> event(new rtclog::Event());
583 event->set_timestamp_us(rtc::TimeMicros());
584 event->set_type(rtclog::Event::ALR_STATE_EVENT);
585
586 auto alr_state = event->mutable_alr_state();
587 alr_state->set_in_alr(in_alr);
588 alr_state->set_usage_bps(usage_bps);
589 StoreEvent(std::move(event));
590 }
591
592 void RtcEventLogImpl::LogPacketQueueTime(uint32_t ssrc, int64_t time_ms) {
593 std::unique_ptr<rtclog::Event> event(new rtclog::Event());
594 event->set_timestamp_us(rtc::TimeMicros());
595 event->set_type(rtclog::Event::PACKET_QUEUE_TIME);
596
597 auto queue_time = event->mutable_packet_queue_time();
598 queue_time->set_queue_time_ms(time_ms);
599 queue_time->set_ssrc(ssrc);
600 StoreEvent(std::move(event));
601 }
602
568 void RtcEventLogImpl::StoreEvent(std::unique_ptr<rtclog::Event> event) { 603 void RtcEventLogImpl::StoreEvent(std::unique_ptr<rtclog::Event> event) {
569 RTC_DCHECK(event.get() != nullptr); 604 RTC_DCHECK(event.get() != nullptr);
570 if (!event_queue_.Insert(&event)) { 605 if (!event_queue_.Insert(&event)) {
571 LOG(LS_ERROR) << "WebRTC event log queue full. Dropping event."; 606 LOG(LS_ERROR) << "WebRTC event log queue full. Dropping event.";
572 } 607 }
573 helper_thread_.SignalNewEvent(); 608 helper_thread_.SignalNewEvent();
574 } 609 }
575 610
576 bool RtcEventLog::ParseRtcEventLog(const std::string& file_name, 611 bool RtcEventLog::ParseRtcEventLog(const std::string& file_name,
577 rtclog::EventStream* result) { 612 rtclog::EventStream* result) {
(...skipping 28 matching lines...) Expand all
606 #else 641 #else
607 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); 642 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl());
608 #endif // ENABLE_RTC_EVENT_LOG 643 #endif // ENABLE_RTC_EVENT_LOG
609 } 644 }
610 645
611 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() { 646 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() {
612 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); 647 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl());
613 } 648 }
614 649
615 } // namespace webrtc 650 } // 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