OLD | NEW |
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 const uint8_t* header, | 70 const uint8_t* header, |
71 size_t packet_length) override; | 71 size_t packet_length) override; |
72 void LogRtcpPacket(PacketDirection direction, | 72 void LogRtcpPacket(PacketDirection direction, |
73 MediaType media_type, | 73 MediaType media_type, |
74 const uint8_t* packet, | 74 const uint8_t* packet, |
75 size_t length) override; | 75 size_t length) override; |
76 void LogAudioPlayout(uint32_t ssrc) override; | 76 void LogAudioPlayout(uint32_t ssrc) override; |
77 void LogBwePacketLossEvent(int32_t bitrate, | 77 void LogBwePacketLossEvent(int32_t bitrate, |
78 uint8_t fraction_loss, | 78 uint8_t fraction_loss, |
79 int32_t total_packets) override; | 79 int32_t total_packets) override; |
| 80 void LogAnaDecisionEvent(rtc::Optional<int> bitrate_bps, |
| 81 rtc::Optional<int> frame_length_ms, |
| 82 rtc::Optional<float> uplink_packet_loss_fraction, |
| 83 rtc::Optional<bool> enable_fec, |
| 84 rtc::Optional<bool> enable_dtx, |
| 85 rtc::Optional<size_t> num_channels) override; |
80 | 86 |
81 private: | 87 private: |
82 void StoreEvent(std::unique_ptr<rtclog::Event>* event); | 88 void StoreEvent(std::unique_ptr<rtclog::Event>* event); |
83 | 89 |
84 // Message queue for passing control messages to the logging thread. | 90 // Message queue for passing control messages to the logging thread. |
85 SwapQueue<RtcEventLogHelperThread::ControlMessage> message_queue_; | 91 SwapQueue<RtcEventLogHelperThread::ControlMessage> message_queue_; |
86 | 92 |
87 // Message queue for passing events to the logging thread. | 93 // Message queue for passing events to the logging thread. |
88 SwapQueue<std::unique_ptr<rtclog::Event> > event_queue_; | 94 SwapQueue<std::unique_ptr<rtclog::Event> > event_queue_; |
89 | 95 |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 auto playout_event = event->mutable_audio_playout_event(); | 428 auto playout_event = event->mutable_audio_playout_event(); |
423 playout_event->set_local_ssrc(ssrc); | 429 playout_event->set_local_ssrc(ssrc); |
424 StoreEvent(&event); | 430 StoreEvent(&event); |
425 } | 431 } |
426 | 432 |
427 void RtcEventLogImpl::LogBwePacketLossEvent(int32_t bitrate, | 433 void RtcEventLogImpl::LogBwePacketLossEvent(int32_t bitrate, |
428 uint8_t fraction_loss, | 434 uint8_t fraction_loss, |
429 int32_t total_packets) { | 435 int32_t total_packets) { |
430 std::unique_ptr<rtclog::Event> event(new rtclog::Event()); | 436 std::unique_ptr<rtclog::Event> event(new rtclog::Event()); |
431 event->set_timestamp_us(clock_->TimeInMicroseconds()); | 437 event->set_timestamp_us(clock_->TimeInMicroseconds()); |
432 event->set_type(rtclog::Event::BWE_PACKET_LOSS_EVENT); | 438 event->set_type(rtclog::Event::AUDIO_NETWORK_ADAPTOR_EVENT); |
433 auto bwe_event = event->mutable_bwe_packet_loss_event(); | 439 auto bwe_event = event->mutable_bwe_packet_loss_event(); |
434 bwe_event->set_bitrate(bitrate); | 440 bwe_event->set_bitrate(bitrate); |
435 bwe_event->set_fraction_loss(fraction_loss); | 441 bwe_event->set_fraction_loss(fraction_loss); |
436 bwe_event->set_total_packets(total_packets); | 442 bwe_event->set_total_packets(total_packets); |
437 StoreEvent(&event); | 443 StoreEvent(&event); |
438 } | 444 } |
439 | 445 |
| 446 void RtcEventLogImpl::LogAnaDecisionEvent( |
| 447 rtc::Optional<int> bitrate_bps, |
| 448 rtc::Optional<int> frame_length_ms, |
| 449 rtc::Optional<float> uplink_packet_loss_fraction, |
| 450 rtc::Optional<bool> enable_fec, |
| 451 rtc::Optional<bool> enable_dtx, |
| 452 rtc::Optional<size_t> num_channels) { |
| 453 std::unique_ptr<rtclog::Event> event(new rtclog::Event()); |
| 454 event->set_timestamp_us(clock_->TimeInMicroseconds()); |
| 455 event->set_type(rtclog::Event::BWE_PACKET_LOSS_EVENT); |
| 456 auto ana_event = event->mutable_audio_network_adaptor_decition(); |
| 457 if (bitrate_bps) |
| 458 ana_event->set_bitrate_bps(*bitrate_bps); |
| 459 if (frame_length_ms) |
| 460 ana_event->set_frame_length_ms(*frame_length_ms); |
| 461 if (uplink_packet_loss_fraction) |
| 462 ana_event->set_uplink_packet_loss_fraction(*uplink_packet_loss_fraction); |
| 463 if (enable_fec) |
| 464 ana_event->set_enable_fec(*enable_fec); |
| 465 if (enable_dtx) |
| 466 ana_event->set_enable_dtx(*enable_dtx); |
| 467 if (num_channels) |
| 468 ana_event->set_num_channels(*num_channels); |
| 469 StoreEvent(&event); |
| 470 } |
| 471 |
440 void RtcEventLogImpl::StoreEvent(std::unique_ptr<rtclog::Event>* event) { | 472 void RtcEventLogImpl::StoreEvent(std::unique_ptr<rtclog::Event>* event) { |
441 if (!event_queue_.Insert(event)) { | 473 if (!event_queue_.Insert(event)) { |
442 LOG(LS_ERROR) << "WebRTC event log queue full. Dropping event."; | 474 LOG(LS_ERROR) << "WebRTC event log queue full. Dropping event."; |
443 } | 475 } |
444 helper_thread_.SignalNewEvent(); | 476 helper_thread_.SignalNewEvent(); |
445 } | 477 } |
446 | 478 |
447 bool RtcEventLog::ParseRtcEventLog(const std::string& file_name, | 479 bool RtcEventLog::ParseRtcEventLog(const std::string& file_name, |
448 rtclog::EventStream* result) { | 480 rtclog::EventStream* result) { |
449 char tmp_buffer[1024]; | 481 char tmp_buffer[1024]; |
(...skipping 28 matching lines...) Expand all Loading... |
478 #else | 510 #else |
479 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); | 511 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); |
480 #endif // ENABLE_RTC_EVENT_LOG | 512 #endif // ENABLE_RTC_EVENT_LOG |
481 } | 513 } |
482 | 514 |
483 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() { | 515 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() { |
484 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); | 516 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); |
485 } | 517 } |
486 | 518 |
487 } // namespace webrtc | 519 } // namespace webrtc |
OLD | NEW |