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

Side by Side Diff: webrtc/voice_engine/channel.cc

Issue 3016473002: Remove encoding code from RtcEventLogImpl and use RtcEventLogEncoder instead (Closed)
Patch Set: 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
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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/voice_engine/channel.h" 11 #include "webrtc/voice_engine/channel.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <map> 14 #include <map>
15 #include <string> 15 #include <string>
16 #include <utility> 16 #include <utility>
17 #include <vector> 17 #include <vector>
18 18
19 #include "webrtc/api/array_view.h" 19 #include "webrtc/api/array_view.h"
20 #include "webrtc/audio/utility/audio_frame_operations.h" 20 #include "webrtc/audio/utility/audio_frame_operations.h"
21 #include "webrtc/call/rtp_transport_controller_send_interface.h" 21 #include "webrtc/call/rtp_transport_controller_send_interface.h"
22 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" 22 #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
23 // TODO(eladalon): Remove events/* after removing the deprecated functions.
24 #include "webrtc/logging/rtc_event_log/events/rtc_event_audio_network_adaptation .h"
25 #include "webrtc/logging/rtc_event_log/events/rtc_event_audio_playout.h"
26 #include "webrtc/logging/rtc_event_log/events/rtc_event_audio_receive_stream_con fig.h"
27 #include "webrtc/logging/rtc_event_log/events/rtc_event_audio_send_stream_config .h"
28 #include "webrtc/logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.h "
29 #include "webrtc/logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.h"
30 #include "webrtc/logging/rtc_event_log/events/rtc_event_logging_started.h"
31 #include "webrtc/logging/rtc_event_log/events/rtc_event_logging_stopped.h"
32 #include "webrtc/logging/rtc_event_log/events/rtc_event_probe_cluster_created.h"
33 #include "webrtc/logging/rtc_event_log/events/rtc_event_probe_result_failure.h"
34 #include "webrtc/logging/rtc_event_log/events/rtc_event_probe_result_success.h"
35 #include "webrtc/logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.h"
36 #include "webrtc/logging/rtc_event_log/events/rtc_event_rtcp_packet_outgoing.h"
37 #include "webrtc/logging/rtc_event_log/events/rtc_event_rtp_packet_incoming.h"
38 #include "webrtc/logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.h"
39 #include "webrtc/logging/rtc_event_log/events/rtc_event_video_receive_stream_con fig.h"
40 #include "webrtc/logging/rtc_event_log/events/rtc_event_video_send_stream_config .h"
41 #include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_networ k_adaptor_config.h"
23 #include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h" 42 #include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h"
24 #include "webrtc/modules/audio_device/include/audio_device.h" 43 #include "webrtc/modules/audio_device/include/audio_device.h"
25 #include "webrtc/modules/audio_processing/include/audio_processing.h" 44 #include "webrtc/modules/audio_processing/include/audio_processing.h"
26 #include "webrtc/modules/include/module_common_types.h" 45 #include "webrtc/modules/include/module_common_types.h"
27 #include "webrtc/modules/pacing/packet_router.h" 46 #include "webrtc/modules/pacing/packet_router.h"
28 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" 47 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h"
29 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h" 48 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h"
30 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" 49 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h"
31 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" 50 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h"
32 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h" 51 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h"
33 #include "webrtc/modules/utility/include/process_thread.h" 52 #include "webrtc/modules/utility/include/process_thread.h"
34 #include "webrtc/rtc_base/checks.h" 53 #include "webrtc/rtc_base/checks.h"
35 #include "webrtc/rtc_base/criticalsection.h" 54 #include "webrtc/rtc_base/criticalsection.h"
36 #include "webrtc/rtc_base/format_macros.h" 55 #include "webrtc/rtc_base/format_macros.h"
37 #include "webrtc/rtc_base/location.h" 56 #include "webrtc/rtc_base/location.h"
38 #include "webrtc/rtc_base/logging.h" 57 #include "webrtc/rtc_base/logging.h"
58 #include "webrtc/rtc_base/ptr_util.h"
39 #include "webrtc/rtc_base/rate_limiter.h" 59 #include "webrtc/rtc_base/rate_limiter.h"
40 #include "webrtc/rtc_base/task_queue.h" 60 #include "webrtc/rtc_base/task_queue.h"
41 #include "webrtc/rtc_base/thread_checker.h" 61 #include "webrtc/rtc_base/thread_checker.h"
42 #include "webrtc/rtc_base/timeutils.h" 62 #include "webrtc/rtc_base/timeutils.h"
43 #include "webrtc/system_wrappers/include/field_trial.h" 63 #include "webrtc/system_wrappers/include/field_trial.h"
44 #include "webrtc/system_wrappers/include/trace.h" 64 #include "webrtc/system_wrappers/include/trace.h"
45 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" 65 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h"
46 #include "webrtc/voice_engine/output_mixer.h" 66 #include "webrtc/voice_engine/output_mixer.h"
47 #include "webrtc/voice_engine/statistics.h" 67 #include "webrtc/voice_engine/statistics.h"
48 #include "webrtc/voice_engine/utility.h" 68 #include "webrtc/voice_engine/utility.h"
(...skipping 22 matching lines...) Expand all
71 } 91 }
72 92
73 bool StartLogging(rtc::PlatformFile log_file, 93 bool StartLogging(rtc::PlatformFile log_file,
74 int64_t max_size_bytes) override { 94 int64_t max_size_bytes) override {
75 RTC_NOTREACHED(); 95 RTC_NOTREACHED();
76 return false; 96 return false;
77 } 97 }
78 98
79 void StopLogging() override { RTC_NOTREACHED(); } 99 void StopLogging() override { RTC_NOTREACHED(); }
80 100
101 void Log(std::unique_ptr<RtcEvent> event) override {
102 rtc::CritScope lock(&crit_);
103 if (event_log_) {
104 event_log_->Log(std::move(event));
105 }
106 }
107
81 void LogVideoReceiveStreamConfig( 108 void LogVideoReceiveStreamConfig(
82 const webrtc::rtclog::StreamConfig&) override { 109 const webrtc::rtclog::StreamConfig&) override {
83 RTC_NOTREACHED(); 110 RTC_NOTREACHED();
84 } 111 }
85 112
86 void LogVideoSendStreamConfig(const webrtc::rtclog::StreamConfig&) override { 113 void LogVideoSendStreamConfig(const webrtc::rtclog::StreamConfig&) override {
87 RTC_NOTREACHED(); 114 RTC_NOTREACHED();
88 } 115 }
89 116
90 void LogAudioReceiveStreamConfig( 117 void LogAudioReceiveStreamConfig(
91 const webrtc::rtclog::StreamConfig& config) override { 118 const webrtc::rtclog::StreamConfig& config) override {
92 rtc::CritScope lock(&crit_); 119 rtc::CritScope lock(&crit_);
93 if (event_log_) { 120 if (event_log_) {
94 event_log_->LogAudioReceiveStreamConfig(config); 121 event_log_->Log(rtc::MakeUnique<RtcEventAudioReceiveStreamConfig>(
122 rtc::MakeUnique<webrtc::rtclog::StreamConfig>(config)));
95 } 123 }
96 } 124 }
97 125
98 void LogAudioSendStreamConfig( 126 void LogAudioSendStreamConfig(
99 const webrtc::rtclog::StreamConfig& config) override { 127 const webrtc::rtclog::StreamConfig& config) override {
100 rtc::CritScope lock(&crit_); 128 rtc::CritScope lock(&crit_);
101 if (event_log_) { 129 if (event_log_) {
102 event_log_->LogAudioSendStreamConfig(config); 130 event_log_->Log(rtc::MakeUnique<RtcEventAudioSendStreamConfig>(
131 rtc::MakeUnique<webrtc::rtclog::StreamConfig>(config)));
103 } 132 }
104 } 133 }
105 134
106 void LogIncomingRtpHeader(const RtpPacketReceived& packet) override { 135 void LogIncomingRtpHeader(const RtpPacketReceived& packet) override {
107 rtc::CritScope lock(&crit_); 136 rtc::CritScope lock(&crit_);
108 if (event_log_) { 137 if (event_log_) {
109 event_log_->LogIncomingRtpHeader(packet); 138 event_log_->Log(rtc::MakeUnique<RtcEventRtpPacketIncoming>(packet));
110 } 139 }
111 } 140 }
112 141
113 void LogOutgoingRtpHeader(const RtpPacketToSend& packet, 142 void LogOutgoingRtpHeader(const RtpPacketToSend& packet,
114 int probe_cluster_id) override { 143 int probe_cluster_id) override {
115 rtc::CritScope lock(&crit_); 144 rtc::CritScope lock(&crit_);
116 if (event_log_) { 145 if (event_log_) {
117 event_log_->LogOutgoingRtpHeader(packet, probe_cluster_id); 146 event_log_->Log(
147 rtc::MakeUnique<RtcEventRtpPacketOutgoing>(packet, probe_cluster_id));
118 } 148 }
119 } 149 }
120 150
121 void LogIncomingRtcpPacket(rtc::ArrayView<const uint8_t> packet) override { 151 void LogIncomingRtcpPacket(rtc::ArrayView<const uint8_t> packet) override {
122 rtc::CritScope lock(&crit_); 152 rtc::CritScope lock(&crit_);
123 if (event_log_) { 153 if (event_log_) {
124 event_log_->LogIncomingRtcpPacket(packet); 154 event_log_->Log(rtc::MakeUnique<RtcEventRtcpPacketIncoming>(packet));
125 } 155 }
126 } 156 }
127 157
128 void LogOutgoingRtcpPacket(rtc::ArrayView<const uint8_t> packet) override { 158 void LogOutgoingRtcpPacket(rtc::ArrayView<const uint8_t> packet) override {
129 rtc::CritScope lock(&crit_); 159 rtc::CritScope lock(&crit_);
130 if (event_log_) { 160 if (event_log_) {
131 event_log_->LogOutgoingRtcpPacket(packet); 161 event_log_->Log(rtc::MakeUnique<RtcEventRtcpPacketOutgoing>(packet));
132 } 162 }
133 } 163 }
134 164
135 void LogAudioPlayout(uint32_t ssrc) override { 165 void LogAudioPlayout(uint32_t ssrc) override {
136 rtc::CritScope lock(&crit_); 166 rtc::CritScope lock(&crit_);
137 if (event_log_) { 167 if (event_log_) {
138 event_log_->LogAudioPlayout(ssrc); 168 event_log_->Log(rtc::MakeUnique<RtcEventAudioPlayout>(ssrc));
139 } 169 }
140 } 170 }
141 171
142 void LogLossBasedBweUpdate(int32_t bitrate_bps, 172 void LogLossBasedBweUpdate(int32_t bitrate_bps,
143 uint8_t fraction_loss, 173 uint8_t fraction_loss,
144 int32_t total_packets) override { 174 int32_t total_packets) override {
145 rtc::CritScope lock(&crit_); 175 rtc::CritScope lock(&crit_);
146 if (event_log_) { 176 if (event_log_) {
147 event_log_->LogLossBasedBweUpdate(bitrate_bps, fraction_loss, 177 event_log_->Log(rtc::MakeUnique<RtcEventBweUpdateLossBased>(
148 total_packets); 178 bitrate_bps, fraction_loss, total_packets));
149 } 179 }
150 } 180 }
151 181
152 void LogDelayBasedBweUpdate(int32_t bitrate_bps, 182 void LogDelayBasedBweUpdate(int32_t bitrate_bps,
153 BandwidthUsage detector_state) override { 183 BandwidthUsage detector_state) override {
154 rtc::CritScope lock(&crit_); 184 rtc::CritScope lock(&crit_);
155 if (event_log_) { 185 if (event_log_) {
156 event_log_->LogDelayBasedBweUpdate(bitrate_bps, detector_state); 186 event_log_->Log(rtc::MakeUnique<RtcEventBweUpdateDelayBased>(
187 bitrate_bps, detector_state));
157 } 188 }
158 } 189 }
159 190
160 void LogAudioNetworkAdaptation( 191 void LogAudioNetworkAdaptation(
161 const AudioEncoderRuntimeConfig& config) override { 192 const AudioEncoderRuntimeConfig& config) override {
162 rtc::CritScope lock(&crit_); 193 rtc::CritScope lock(&crit_);
163 if (event_log_) { 194 if (event_log_) {
164 event_log_->LogAudioNetworkAdaptation(config); 195 event_log_->Log(rtc::MakeUnique<RtcEventAudioNetworkAdaptation>(
196 rtc::MakeUnique<AudioEncoderRuntimeConfig>(config)));
165 } 197 }
166 } 198 }
167 199
168 void LogProbeClusterCreated(int id, 200 void LogProbeClusterCreated(int id,
169 int bitrate_bps, 201 int bitrate_bps,
170 int min_probes, 202 int min_probes,
171 int min_bytes) override { 203 int min_bytes) override {
172 rtc::CritScope lock(&crit_); 204 rtc::CritScope lock(&crit_);
173 if (event_log_) { 205 if (event_log_) {
174 event_log_->LogProbeClusterCreated(id, bitrate_bps, min_probes, 206 event_log_->Log(rtc::MakeUnique<RtcEventProbeClusterCreated>(
175 min_bytes); 207 id, bitrate_bps, min_probes, min_bytes));
176 } 208 }
177 }; 209 };
178 210
179 void LogProbeResultSuccess(int id, int bitrate_bps) override { 211 void LogProbeResultSuccess(int id, int bitrate_bps) override {
180 rtc::CritScope lock(&crit_); 212 rtc::CritScope lock(&crit_);
181 if (event_log_) { 213 if (event_log_) {
182 event_log_->LogProbeResultSuccess(id, bitrate_bps); 214 event_log_->Log(
215 rtc::MakeUnique<RtcEventProbeResultSuccess>(id, bitrate_bps));
183 } 216 }
184 }; 217 };
185 218
186 void LogProbeResultFailure(int id, 219 void LogProbeResultFailure(int id,
187 ProbeFailureReason failure_reason) override { 220 ProbeFailureReason failure_reason) override {
188 rtc::CritScope lock(&crit_); 221 rtc::CritScope lock(&crit_);
189 if (event_log_) { 222 if (event_log_) {
190 event_log_->LogProbeResultFailure(id, failure_reason); 223 event_log_->Log(
224 rtc::MakeUnique<RtcEventProbeResultFailure>(id, failure_reason));
191 } 225 }
192 }; 226 };
193 227
194 void SetEventLog(RtcEventLog* event_log) { 228 void SetEventLog(RtcEventLog* event_log) {
195 rtc::CritScope lock(&crit_); 229 rtc::CritScope lock(&crit_);
196 event_log_ = event_log; 230 event_log_ = event_log;
197 } 231 }
198 232
199 private: 233 private:
200 rtc::CriticalSection crit_; 234 rtc::CriticalSection crit_;
(...skipping 2937 matching lines...) Expand 10 before | Expand all | Expand 10 after
3138 int64_t min_rtt = 0; 3172 int64_t min_rtt = 0;
3139 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 3173 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) !=
3140 0) { 3174 0) {
3141 return 0; 3175 return 0;
3142 } 3176 }
3143 return rtt; 3177 return rtt;
3144 } 3178 }
3145 3179
3146 } // namespace voe 3180 } // namespace voe
3147 } // namespace webrtc 3181 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698