| 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 LogAudioNetworkAdaptation( | |
| 81 const AudioNetworkAdaptor::EncoderRuntimeConfig& config) override; | |
| 82 | 80 |
| 83 private: | 81 private: |
| 84 void StoreEvent(std::unique_ptr<rtclog::Event>* event); | 82 void StoreEvent(std::unique_ptr<rtclog::Event>* event); |
| 85 | 83 |
| 86 // Message queue for passing control messages to the logging thread. | 84 // Message queue for passing control messages to the logging thread. |
| 87 SwapQueue<RtcEventLogHelperThread::ControlMessage> message_queue_; | 85 SwapQueue<RtcEventLogHelperThread::ControlMessage> message_queue_; |
| 88 | 86 |
| 89 // Message queue for passing events to the logging thread. | 87 // Message queue for passing events to the logging thread. |
| 90 SwapQueue<std::unique_ptr<rtclog::Event> > event_queue_; | 88 SwapQueue<std::unique_ptr<rtclog::Event> > event_queue_; |
| 91 | 89 |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 std::unique_ptr<rtclog::Event> event(new rtclog::Event()); | 427 std::unique_ptr<rtclog::Event> event(new rtclog::Event()); |
| 430 event->set_timestamp_us(rtc::TimeMicros()); | 428 event->set_timestamp_us(rtc::TimeMicros()); |
| 431 event->set_type(rtclog::Event::BWE_PACKET_LOSS_EVENT); | 429 event->set_type(rtclog::Event::BWE_PACKET_LOSS_EVENT); |
| 432 auto bwe_event = event->mutable_bwe_packet_loss_event(); | 430 auto bwe_event = event->mutable_bwe_packet_loss_event(); |
| 433 bwe_event->set_bitrate(bitrate); | 431 bwe_event->set_bitrate(bitrate); |
| 434 bwe_event->set_fraction_loss(fraction_loss); | 432 bwe_event->set_fraction_loss(fraction_loss); |
| 435 bwe_event->set_total_packets(total_packets); | 433 bwe_event->set_total_packets(total_packets); |
| 436 StoreEvent(&event); | 434 StoreEvent(&event); |
| 437 } | 435 } |
| 438 | 436 |
| 439 void RtcEventLogImpl::LogAudioNetworkAdaptation( | |
| 440 const AudioNetworkAdaptor::EncoderRuntimeConfig& config) { | |
| 441 std::unique_ptr<rtclog::Event> event(new rtclog::Event()); | |
| 442 event->set_timestamp_us(rtc::TimeMicros()); | |
| 443 event->set_type(rtclog::Event::AUDIO_NETWORK_ADAPTATION_EVENT); | |
| 444 auto audio_network_adaptation = event->mutable_audio_network_adaptation(); | |
| 445 if (config.bitrate_bps) | |
| 446 audio_network_adaptation->set_bitrate_bps(*config.bitrate_bps); | |
| 447 if (config.frame_length_ms) | |
| 448 audio_network_adaptation->set_frame_length_ms(*config.frame_length_ms); | |
| 449 if (config.uplink_packet_loss_fraction) { | |
| 450 audio_network_adaptation->set_uplink_packet_loss_fraction( | |
| 451 *config.uplink_packet_loss_fraction); | |
| 452 } | |
| 453 if (config.enable_fec) | |
| 454 audio_network_adaptation->set_enable_fec(*config.enable_fec); | |
| 455 if (config.enable_dtx) | |
| 456 audio_network_adaptation->set_enable_dtx(*config.enable_dtx); | |
| 457 if (config.num_channels) | |
| 458 audio_network_adaptation->set_num_channels(*config.num_channels); | |
| 459 StoreEvent(&event); | |
| 460 } | |
| 461 | |
| 462 void RtcEventLogImpl::StoreEvent(std::unique_ptr<rtclog::Event>* event) { | 437 void RtcEventLogImpl::StoreEvent(std::unique_ptr<rtclog::Event>* event) { |
| 463 if (!event_queue_.Insert(event)) { | 438 if (!event_queue_.Insert(event)) { |
| 464 LOG(LS_ERROR) << "WebRTC event log queue full. Dropping event."; | 439 LOG(LS_ERROR) << "WebRTC event log queue full. Dropping event."; |
| 465 } | 440 } |
| 466 helper_thread_.SignalNewEvent(); | 441 helper_thread_.SignalNewEvent(); |
| 467 } | 442 } |
| 468 | 443 |
| 469 bool RtcEventLog::ParseRtcEventLog(const std::string& file_name, | 444 bool RtcEventLog::ParseRtcEventLog(const std::string& file_name, |
| 470 rtclog::EventStream* result) { | 445 rtclog::EventStream* result) { |
| 471 char tmp_buffer[1024]; | 446 char tmp_buffer[1024]; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 500 #else | 475 #else |
| 501 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); | 476 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); |
| 502 #endif // ENABLE_RTC_EVENT_LOG | 477 #endif // ENABLE_RTC_EVENT_LOG |
| 503 } | 478 } |
| 504 | 479 |
| 505 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() { | 480 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() { |
| 506 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); | 481 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); |
| 507 } | 482 } |
| 508 | 483 |
| 509 } // namespace webrtc | 484 } // namespace webrtc |
| OLD | NEW |