| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 return rtclog::MediaType::DATA; | 114 return rtclog::MediaType::DATA; |
| 115 } | 115 } |
| 116 RTC_NOTREACHED(); | 116 RTC_NOTREACHED(); |
| 117 return rtclog::ANY; | 117 return rtclog::ANY; |
| 118 } | 118 } |
| 119 | 119 |
| 120 // The RTP and RTCP buffers reserve space for twice the expected number of | 120 // The RTP and RTCP buffers reserve space for twice the expected number of |
| 121 // sent packets because they also contain received packets. | 121 // sent packets because they also contain received packets. |
| 122 static const int kEventsPerSecond = 1000; | 122 static const int kEventsPerSecond = 1000; |
| 123 static const int kControlMessagesPerSecond = 10; | 123 static const int kControlMessagesPerSecond = 10; |
| 124 |
| 124 } // namespace | 125 } // namespace |
| 125 | 126 |
| 126 // RtcEventLogImpl member functions. | 127 // RtcEventLogImpl member functions. |
| 127 RtcEventLogImpl::RtcEventLogImpl(const Clock* clock) | 128 RtcEventLogImpl::RtcEventLogImpl(const Clock* clock) |
| 128 // Allocate buffers for roughly one second of history. | 129 // Allocate buffers for roughly one second of history. |
| 129 : message_queue_(kControlMessagesPerSecond), | 130 : message_queue_(kControlMessagesPerSecond), |
| 130 event_queue_(kEventsPerSecond), | 131 event_queue_(kEventsPerSecond), |
| 131 clock_(clock), | 132 clock_(clock), |
| 132 helper_thread_(&message_queue_, | 133 helper_thread_(&message_queue_, |
| 133 &event_queue_, | 134 &event_queue_, |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 std::string dump_buffer; | 414 std::string dump_buffer; |
| 414 while ((bytes_read = dump_file->Read(tmp_buffer, sizeof(tmp_buffer))) > 0) { | 415 while ((bytes_read = dump_file->Read(tmp_buffer, sizeof(tmp_buffer))) > 0) { |
| 415 dump_buffer.append(tmp_buffer, bytes_read); | 416 dump_buffer.append(tmp_buffer, bytes_read); |
| 416 } | 417 } |
| 417 dump_file->CloseFile(); | 418 dump_file->CloseFile(); |
| 418 return result->ParseFromString(dump_buffer); | 419 return result->ParseFromString(dump_buffer); |
| 419 } | 420 } |
| 420 | 421 |
| 421 #endif // ENABLE_RTC_EVENT_LOG | 422 #endif // ENABLE_RTC_EVENT_LOG |
| 422 | 423 |
| 423 bool RtcEventLogNullImpl::StartLogging(rtc::PlatformFile platform_file, | |
| 424 int64_t max_size_bytes) { | |
| 425 // The platform_file is open and needs to be closed. | |
| 426 if (!rtc::ClosePlatformFile(platform_file)) { | |
| 427 LOG(LS_ERROR) << "Can't close file."; | |
| 428 } | |
| 429 return false; | |
| 430 } | |
| 431 | |
| 432 // RtcEventLog member functions. | 424 // RtcEventLog member functions. |
| 433 std::unique_ptr<RtcEventLog> RtcEventLog::Create(const Clock* clock) { | 425 std::unique_ptr<RtcEventLog> RtcEventLog::Create(const Clock* clock) { |
| 434 #ifdef ENABLE_RTC_EVENT_LOG | 426 #ifdef ENABLE_RTC_EVENT_LOG |
| 435 return std::unique_ptr<RtcEventLog>(new RtcEventLogImpl(clock)); | 427 return std::unique_ptr<RtcEventLog>(new RtcEventLogImpl(clock)); |
| 436 #else | 428 #else |
| 437 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); | 429 return std::unique_ptr<RtcEventLog>(); |
| 438 #endif // ENABLE_RTC_EVENT_LOG | 430 #endif // ENABLE_RTC_EVENT_LOG |
| 439 } | 431 } |
| 440 | 432 |
| 441 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() { | |
| 442 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); | |
| 443 } | |
| 444 | |
| 445 } // namespace webrtc | 433 } // namespace webrtc |
| OLD | NEW |