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

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

Issue 1411673003: Added protobuf message for loss-based BWE events, and wired it up to the send side bandwidth estima… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Logging for loss based BWE Created 5 years, 2 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 const VideoSendStream::Config& config) override {} 45 const VideoSendStream::Config& config) override {}
46 void LogRtpHeader(bool incoming, 46 void LogRtpHeader(bool incoming,
47 MediaType media_type, 47 MediaType media_type,
48 const uint8_t* header, 48 const uint8_t* header,
49 size_t packet_length) override {} 49 size_t packet_length) override {}
50 void LogRtcpPacket(bool incoming, 50 void LogRtcpPacket(bool incoming,
51 MediaType media_type, 51 MediaType media_type,
52 const uint8_t* packet, 52 const uint8_t* packet,
53 size_t length) override {} 53 size_t length) override {}
54 void LogAudioPlayout(uint32_t ssrc) override {} 54 void LogAudioPlayout(uint32_t ssrc) override {}
55 void LogBwePacketLossEvent(int32_t bitrate,
56 uint8_t fraction_loss,
57 int32_t total_packets) override {}
55 }; 58 };
56 59
57 #else // ENABLE_RTC_EVENT_LOG is defined 60 #else // ENABLE_RTC_EVENT_LOG is defined
58 61
59 class RtcEventLogImpl final : public RtcEventLog { 62 class RtcEventLogImpl final : public RtcEventLog {
60 public: 63 public:
61 void StartLogging(const std::string& file_name, int duration_ms) override; 64 void StartLogging(const std::string& file_name, int duration_ms) override;
62 bool StartLogging(rtc::PlatformFile log_file) override; 65 bool StartLogging(rtc::PlatformFile log_file) override;
63 void StopLogging() override; 66 void StopLogging() override;
64 void LogVideoReceiveStreamConfig( 67 void LogVideoReceiveStreamConfig(
65 const VideoReceiveStream::Config& config) override; 68 const VideoReceiveStream::Config& config) override;
66 void LogVideoSendStreamConfig(const VideoSendStream::Config& config) override; 69 void LogVideoSendStreamConfig(const VideoSendStream::Config& config) override;
67 void LogRtpHeader(bool incoming, 70 void LogRtpHeader(bool incoming,
68 MediaType media_type, 71 MediaType media_type,
69 const uint8_t* header, 72 const uint8_t* header,
70 size_t packet_length) override; 73 size_t packet_length) override;
71 void LogRtcpPacket(bool incoming, 74 void LogRtcpPacket(bool incoming,
72 MediaType media_type, 75 MediaType media_type,
73 const uint8_t* packet, 76 const uint8_t* packet,
74 size_t length) override; 77 size_t length) override;
75 void LogAudioPlayout(uint32_t ssrc) override; 78 void LogAudioPlayout(uint32_t ssrc) override;
79 void LogBwePacketLossEvent(int32_t bitrate,
80 uint8_t fraction_loss,
81 int32_t total_packets) override;
76 82
77 private: 83 private:
78 // Starts logging. This function assumes the file_ has been opened succesfully 84 // Starts logging. This function assumes the file_ has been opened succesfully
79 // and that the start_time_us_ and _duration_us_ have been set. 85 // and that the start_time_us_ and _duration_us_ have been set.
80 void StartLoggingLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_); 86 void StartLoggingLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_);
81 // Stops logging and clears the stored data and buffers. 87 // Stops logging and clears the stored data and buffers.
82 void StopLoggingLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_); 88 void StopLoggingLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_);
83 // Adds a new event to the logfile if logging is active, or adds it to the 89 // Adds a new event to the logfile if logging is active, or adds it to the
84 // list of recent log events otherwise. 90 // list of recent log events otherwise.
85 void HandleEvent(rtclog::Event* event) EXCLUSIVE_LOCKS_REQUIRED(crit_); 91 void HandleEvent(rtclog::Event* event) EXCLUSIVE_LOCKS_REQUIRED(crit_);
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 rtc::CritScope lock(&crit_); 354 rtc::CritScope lock(&crit_);
349 rtclog::Event event; 355 rtclog::Event event;
350 const int64_t timestamp = clock_->TimeInMicroseconds(); 356 const int64_t timestamp = clock_->TimeInMicroseconds();
351 event.set_timestamp_us(timestamp); 357 event.set_timestamp_us(timestamp);
352 event.set_type(rtclog::Event::AUDIO_PLAYOUT_EVENT); 358 event.set_type(rtclog::Event::AUDIO_PLAYOUT_EVENT);
353 auto playout_event = event.mutable_audio_playout_event(); 359 auto playout_event = event.mutable_audio_playout_event();
354 playout_event->set_local_ssrc(ssrc); 360 playout_event->set_local_ssrc(ssrc);
355 HandleEvent(&event); 361 HandleEvent(&event);
356 } 362 }
357 363
364 void RtcEventLogImpl::LogBwePacketLossEvent(int32_t bitrate,
365 uint8_t fraction_loss,
366 int32_t total_packets) {
367 rtc::CritScope lock(&crit_);
368 rtclog::Event event;
369 const int64_t timestamp = clock_->TimeInMicroseconds();
370 event.set_timestamp_us(timestamp);
stefan-webrtc 2015/10/19 08:43:21 Pass in clock_->TimeInMicroseconds() directly.
terelius 2015/10/26 17:40:18 I agree with this idea for Rtcp and Rtp packets si
stefan-webrtc 2015/10/28 16:03:18 Oh, I meant that instead of doing event.set_timest
terelius 2015/10/30 10:51:40 Done. Sorry, I misunderstood what you wanted.
371 event.set_type(rtclog::Event::BWE_PACKET_LOSS_EVENT);
372 auto bwe_event = event.mutable_bwe_packet_loss_event();
373 bwe_event->set_bitrate(bitrate);
374 bwe_event->set_fraction_loss(fraction_loss);
375 bwe_event->set_total_packets(total_packets);
376 HandleEvent(&event);
377 }
378
358 void RtcEventLogImpl::StopLoggingLocked() { 379 void RtcEventLogImpl::StopLoggingLocked() {
359 if (currently_logging_) { 380 if (currently_logging_) {
360 currently_logging_ = false; 381 currently_logging_ = false;
361 // Create a LogEnd event 382 // Create a LogEnd event
362 rtclog::Event event; 383 rtclog::Event event;
363 int64_t timestamp = clock_->TimeInMicroseconds(); 384 int64_t timestamp = clock_->TimeInMicroseconds();
364 event.set_timestamp_us(timestamp); 385 event.set_timestamp_us(timestamp);
365 event.set_type(rtclog::Event::LOG_END); 386 event.set_type(rtclog::Event::LOG_END);
366 // Store the event and close the file 387 // Store the event and close the file
367 RTC_DCHECK(file_->Open()); 388 RTC_DCHECK(file_->Open());
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 return result->ParseFromString(dump_buffer); 446 return result->ParseFromString(dump_buffer);
426 } 447 }
427 448
428 #endif // ENABLE_RTC_EVENT_LOG 449 #endif // ENABLE_RTC_EVENT_LOG
429 450
430 // RtcEventLog member functions. 451 // RtcEventLog member functions.
431 rtc::scoped_ptr<RtcEventLog> RtcEventLog::Create() { 452 rtc::scoped_ptr<RtcEventLog> RtcEventLog::Create() {
432 return rtc::scoped_ptr<RtcEventLog>(new RtcEventLogImpl()); 453 return rtc::scoped_ptr<RtcEventLog>(new RtcEventLogImpl());
433 } 454 }
434 } // namespace webrtc 455 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698