Chromium Code Reviews| 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 LogEncoderRuntimeConfig( | |
| 81 const AudioNetworkAdaptor::EncoderRuntimeConfig& config) override; | |
| 80 | 82 |
| 81 private: | 83 private: |
| 82 void StoreEvent(std::unique_ptr<rtclog::Event>* event); | 84 void StoreEvent(std::unique_ptr<rtclog::Event>* event); |
| 83 | 85 |
| 84 // Message queue for passing control messages to the logging thread. | 86 // Message queue for passing control messages to the logging thread. |
| 85 SwapQueue<RtcEventLogHelperThread::ControlMessage> message_queue_; | 87 SwapQueue<RtcEventLogHelperThread::ControlMessage> message_queue_; |
| 86 | 88 |
| 87 // Message queue for passing events to the logging thread. | 89 // Message queue for passing events to the logging thread. |
| 88 SwapQueue<std::unique_ptr<rtclog::Event> > event_queue_; | 90 SwapQueue<std::unique_ptr<rtclog::Event> > event_queue_; |
| 89 | 91 |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 430 std::unique_ptr<rtclog::Event> event(new rtclog::Event()); | 432 std::unique_ptr<rtclog::Event> event(new rtclog::Event()); |
| 431 event->set_timestamp_us(clock_->TimeInMicroseconds()); | 433 event->set_timestamp_us(clock_->TimeInMicroseconds()); |
| 432 event->set_type(rtclog::Event::BWE_PACKET_LOSS_EVENT); | 434 event->set_type(rtclog::Event::BWE_PACKET_LOSS_EVENT); |
| 433 auto bwe_event = event->mutable_bwe_packet_loss_event(); | 435 auto bwe_event = event->mutable_bwe_packet_loss_event(); |
| 434 bwe_event->set_bitrate(bitrate); | 436 bwe_event->set_bitrate(bitrate); |
| 435 bwe_event->set_fraction_loss(fraction_loss); | 437 bwe_event->set_fraction_loss(fraction_loss); |
| 436 bwe_event->set_total_packets(total_packets); | 438 bwe_event->set_total_packets(total_packets); |
| 437 StoreEvent(&event); | 439 StoreEvent(&event); |
| 438 } | 440 } |
| 439 | 441 |
| 442 void RtcEventLogImpl::LogEncoderRuntimeConfig( | |
| 443 const AudioNetworkAdaptor::EncoderRuntimeConfig& config) { | |
| 444 std::unique_ptr<rtclog::Event> event(new rtclog::Event()); | |
| 445 event->set_timestamp_us(clock_->TimeInMicroseconds()); | |
| 446 event->set_type(rtclog::Event::AUDIO_NETWORK_ADAPTOR_EVENT); | |
|
minyue-webrtc
2016/12/20 10:39:29
Slightly confusing is that the function is LogEnco
michaelt
2016/12/20 13:41:41
Done.
minyue-webrtc
2016/12/20 14:11:05
Almost, but we cannot drop "Audio" in the function
michaelt
2016/12/20 14:34:03
Right :)
Done
| |
| 447 auto ana_event = event->mutable_encoder_runtime_config(); | |
| 448 if (config.bitrate_bps) | |
|
minyue-webrtc
2016/12/20 10:39:29
how about making 448 ~ 460 a utility function, whi
michaelt
2016/12/20 13:41:40
Done.
| |
| 449 ana_event->set_bitrate_bps(*config.bitrate_bps); | |
| 450 if (config.frame_length_ms) | |
| 451 ana_event->set_frame_length_ms(*config.frame_length_ms); | |
| 452 if (config.uplink_packet_loss_fraction) | |
| 453 ana_event->set_uplink_packet_loss_fraction( | |
| 454 *config.uplink_packet_loss_fraction); | |
| 455 if (config.enable_fec) | |
| 456 ana_event->set_enable_fec(*config.enable_fec); | |
| 457 if (config.enable_dtx) | |
| 458 ana_event->set_enable_dtx(*config.enable_dtx); | |
| 459 if (config.num_channels) | |
| 460 ana_event->set_num_channels(*config.num_channels); | |
| 461 StoreEvent(&event); | |
| 462 } | |
| 463 | |
| 440 void RtcEventLogImpl::StoreEvent(std::unique_ptr<rtclog::Event>* event) { | 464 void RtcEventLogImpl::StoreEvent(std::unique_ptr<rtclog::Event>* event) { |
| 441 if (!event_queue_.Insert(event)) { | 465 if (!event_queue_.Insert(event)) { |
| 442 LOG(LS_ERROR) << "WebRTC event log queue full. Dropping event."; | 466 LOG(LS_ERROR) << "WebRTC event log queue full. Dropping event."; |
| 443 } | 467 } |
| 444 helper_thread_.SignalNewEvent(); | 468 helper_thread_.SignalNewEvent(); |
| 445 } | 469 } |
| 446 | 470 |
| 447 bool RtcEventLog::ParseRtcEventLog(const std::string& file_name, | 471 bool RtcEventLog::ParseRtcEventLog(const std::string& file_name, |
| 448 rtclog::EventStream* result) { | 472 rtclog::EventStream* result) { |
| 449 char tmp_buffer[1024]; | 473 char tmp_buffer[1024]; |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 478 #else | 502 #else |
| 479 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); | 503 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); |
| 480 #endif // ENABLE_RTC_EVENT_LOG | 504 #endif // ENABLE_RTC_EVENT_LOG |
| 481 } | 505 } |
| 482 | 506 |
| 483 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() { | 507 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() { |
| 484 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); | 508 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); |
| 485 } | 509 } |
| 486 | 510 |
| 487 } // namespace webrtc | 511 } // namespace webrtc |
| OLD | NEW |