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

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

Issue 2800633004: Resolve dependency between rtc_event_log_api and remote_bitrate_estimator (Closed)
Patch Set: Rebased Created 3 years, 8 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) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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_parser.h" 11 #include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h"
12 12
13 #include <stdint.h> 13 #include <stdint.h>
14 #include <string.h> 14 #include <string.h>
15 15
16 #include <algorithm> 16 #include <algorithm>
17 #include <fstream> 17 #include <fstream>
18 #include <istream> 18 #include <istream>
19 #include <utility> 19 #include <utility>
20 20
21 #include "webrtc/base/checks.h" 21 #include "webrtc/base/checks.h"
22 #include "webrtc/base/logging.h" 22 #include "webrtc/base/logging.h"
23 #include "webrtc/base/protobuf_utils.h" 23 #include "webrtc/base/protobuf_utils.h"
24 #include "webrtc/call/call.h" 24 #include "webrtc/call/call.h"
25 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" 25 #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
26 #include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_networ k_adaptor.h" 26 #include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_networ k_adaptor.h"
27 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h"
27 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 28 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
28 29
29 namespace webrtc { 30 namespace webrtc {
30 31
31 namespace { 32 namespace {
32 MediaType GetRuntimeMediaType(rtclog::MediaType media_type) { 33 MediaType GetRuntimeMediaType(rtclog::MediaType media_type) {
33 switch (media_type) { 34 switch (media_type) {
34 case rtclog::MediaType::ANY: 35 case rtclog::MediaType::ANY:
35 return MediaType::ANY; 36 return MediaType::ANY;
36 case rtclog::MediaType::AUDIO: 37 case rtclog::MediaType::AUDIO:
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 return ParsedRtcEventLog::EventType::BWE_PROBE_RESULT_EVENT; 91 return ParsedRtcEventLog::EventType::BWE_PROBE_RESULT_EVENT;
91 } 92 }
92 RTC_NOTREACHED(); 93 RTC_NOTREACHED();
93 return ParsedRtcEventLog::EventType::UNKNOWN_EVENT; 94 return ParsedRtcEventLog::EventType::UNKNOWN_EVENT;
94 } 95 }
95 96
96 BandwidthUsage GetRuntimeDetectorState( 97 BandwidthUsage GetRuntimeDetectorState(
97 rtclog::DelayBasedBweUpdate::DetectorState detector_state) { 98 rtclog::DelayBasedBweUpdate::DetectorState detector_state) {
98 switch (detector_state) { 99 switch (detector_state) {
99 case rtclog::DelayBasedBweUpdate::BWE_NORMAL: 100 case rtclog::DelayBasedBweUpdate::BWE_NORMAL:
100 return kBwNormal; 101 return BandwidthUsage::kBwNormal;
101 case rtclog::DelayBasedBweUpdate::BWE_UNDERUSING: 102 case rtclog::DelayBasedBweUpdate::BWE_UNDERUSING:
102 return kBwUnderusing; 103 return BandwidthUsage::kBwUnderusing;
103 case rtclog::DelayBasedBweUpdate::BWE_OVERUSING: 104 case rtclog::DelayBasedBweUpdate::BWE_OVERUSING:
104 return kBwOverusing; 105 return BandwidthUsage::kBwOverusing;
105 } 106 }
106 RTC_NOTREACHED(); 107 RTC_NOTREACHED();
107 return kBwNormal; 108 return BandwidthUsage::kBwNormal;
108 } 109 }
109 110
110 std::pair<uint64_t, bool> ParseVarInt(std::istream& stream) { 111 std::pair<uint64_t, bool> ParseVarInt(std::istream& stream) {
111 uint64_t varint = 0; 112 uint64_t varint = 0;
112 for (size_t bytes_read = 0; bytes_read < 10; ++bytes_read) { 113 for (size_t bytes_read = 0; bytes_read < 10; ++bytes_read) {
113 // The most significant bit of each byte is 0 if it is the last byte in 114 // The most significant bit of each byte is 0 if it is the last byte in
114 // the varint and 1 otherwise. Thus, we take the 7 least significant bits 115 // the varint and 1 otherwise. Thus, we take the 7 least significant bits
115 // of each byte and shift them 7 bits for each byte read previously to get 116 // of each byte and shift them 7 bits for each byte read previously to get
116 // the (unsigned) integer. 117 // the (unsigned) integer.
117 int byte = stream.get(); 118 int byte = stream.get();
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 rtc::Optional<ProbeFailureReason>(kInvalidSendReceiveRatio); 585 rtc::Optional<ProbeFailureReason>(kInvalidSendReceiveRatio);
585 } else if (pr_event.result() == rtclog::BweProbeResult::TIMEOUT) { 586 } else if (pr_event.result() == rtclog::BweProbeResult::TIMEOUT) {
586 res.failure_reason = rtc::Optional<ProbeFailureReason>(kTimeout); 587 res.failure_reason = rtc::Optional<ProbeFailureReason>(kTimeout);
587 } else { 588 } else {
588 RTC_NOTREACHED(); 589 RTC_NOTREACHED();
589 } 590 }
590 591
591 return res; 592 return res;
592 } 593 }
593 } // namespace webrtc 594 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/logging/rtc_event_log/rtc_event_log.cc ('k') | webrtc/logging/rtc_event_log/rtc_event_log_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698