| 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 |
| 11 #ifndef WEBRTC_LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_H_ | 11 #ifndef WEBRTC_LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_H_ |
| 12 #define WEBRTC_LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_H_ | 12 #define WEBRTC_LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_H_ |
| 13 | 13 |
| 14 #include <memory> | |
| 15 #include <string> | 14 #include <string> |
| 16 #include <vector> | |
| 17 | 15 |
| 18 #include "webrtc/api/array_view.h" | 16 #include "webrtc/api/array_view.h" |
| 19 #include "webrtc/api/rtpparameters.h" | 17 #include "webrtc/api/rtpparameters.h" |
| 20 #include "webrtc/common_types.h" | 18 #include "webrtc/common_types.h" |
| 19 #include "webrtc/logging/rtc_event_log/encoder/rtc_event_log_encoder.h" |
| 20 // TODO(eladalon): Remove this in an upcoming CL, that will modularize the |
| 21 // log output into its own class. |
| 21 #include "webrtc/rtc_base/platform_file.h" | 22 #include "webrtc/rtc_base/platform_file.h" |
| 22 | 23 |
| 23 namespace webrtc { | 24 namespace webrtc { |
| 24 | 25 |
| 25 // Forward declaration of storage class that is automatically generated from | 26 // TODO(eladalon): !!! Which are no longer needed? |
| 26 // the protobuf file. | |
| 27 namespace rtclog { | |
| 28 class EventStream; | |
| 29 | |
| 30 struct StreamConfig { | |
| 31 uint32_t local_ssrc = 0; | |
| 32 uint32_t remote_ssrc = 0; | |
| 33 uint32_t rtx_ssrc = 0; | |
| 34 std::string rsid; | |
| 35 | |
| 36 bool remb = false; | |
| 37 std::vector<RtpExtension> rtp_extensions; | |
| 38 | |
| 39 RtcpMode rtcp_mode = RtcpMode::kReducedSize; | |
| 40 | |
| 41 struct Codec { | |
| 42 Codec(const std::string& payload_name, | |
| 43 int payload_type, | |
| 44 int rtx_payload_type) | |
| 45 : payload_name(payload_name), | |
| 46 payload_type(payload_type), | |
| 47 rtx_payload_type(rtx_payload_type) {} | |
| 48 | |
| 49 std::string payload_name; | |
| 50 int payload_type; | |
| 51 int rtx_payload_type; | |
| 52 }; | |
| 53 std::vector<Codec> codecs; | |
| 54 }; | |
| 55 | |
| 56 } // namespace rtclog | |
| 57 | |
| 58 class Clock; | 27 class Clock; |
| 59 struct AudioEncoderRuntimeConfig; | 28 struct AudioEncoderRuntimeConfig; |
| 60 class RtpPacketReceived; | 29 class RtpPacketReceived; |
| 61 class RtpPacketToSend; | 30 class RtpPacketToSend; |
| 62 | |
| 63 enum class MediaType; | |
| 64 enum class BandwidthUsage; | 31 enum class BandwidthUsage; |
| 65 | 32 |
| 66 enum PacketDirection { kIncomingPacket = 0, kOutgoingPacket }; | 33 // TODO(eladalon): Two stages are upcoming. |
| 67 enum ProbeFailureReason { | 34 // 1. Extend this to actually support the new encoding. |
| 68 kInvalidSendReceiveInterval, | 35 // 2. Get rid of the legacy encoding, allowing us to get rid of this enum. |
| 69 kInvalidSendReceiveRatio, | 36 enum class EncodingType { Legacy }; |
| 70 kTimeout | |
| 71 }; | |
| 72 | 37 |
| 73 class RtcEventLog { | 38 class RtcEventLog { |
| 74 public: | 39 public: |
| 75 virtual ~RtcEventLog() {} | 40 virtual ~RtcEventLog() {} |
| 76 | 41 |
| 77 // Factory method to create an RtcEventLog object. | 42 // Factory method to create an RtcEventLog object. |
| 78 static std::unique_ptr<RtcEventLog> Create(); | 43 // TODO(eladalon): Get rid of the default value after internal projects fixed. |
| 44 static std::unique_ptr<RtcEventLog> Create( |
| 45 EncodingType encoding_type = EncodingType::Legacy); |
| 79 // TODO(nisse): webrtc::Clock is deprecated. Delete this method and | 46 // TODO(nisse): webrtc::Clock is deprecated. Delete this method and |
| 80 // above forward declaration of Clock when | 47 // above forward declaration of Clock when |
| 81 // webrtc/system_wrappers/include/clock.h is deleted. | 48 // webrtc/system_wrappers/include/clock.h is deleted. |
| 82 static std::unique_ptr<RtcEventLog> Create(const Clock* clock) { | 49 // TODO(eladalon): Get rid of the default value after internal projects fixed. |
| 83 return Create(); | 50 static std::unique_ptr<RtcEventLog> Create( |
| 51 const Clock* clock, |
| 52 EncodingType encoding_type = EncodingType::Legacy) { |
| 53 return Create(encoding_type); |
| 84 } | 54 } |
| 85 | 55 |
| 86 // Create an RtcEventLog object that does nothing. | 56 // Create an RtcEventLog object that does nothing. |
| 87 static std::unique_ptr<RtcEventLog> CreateNull(); | 57 static std::unique_ptr<RtcEventLog> CreateNull(); |
| 88 | 58 |
| 59 // TODO(eladalon): !!! Explain |
| 60 static std::unique_ptr<RtcEventLogEncoder> CreateEncoder(EncodingType type); |
| 61 |
| 89 // Starts logging a maximum of max_size_bytes bytes to the specified file. | 62 // Starts logging a maximum of max_size_bytes bytes to the specified file. |
| 90 // If the file already exists it will be overwritten. | 63 // If the file already exists it will be overwritten. |
| 91 // If max_size_bytes <= 0, logging will be active until StopLogging is called. | 64 // If max_size_bytes <= 0, logging will be active until StopLogging is called. |
| 92 // The function has no effect and returns false if we can't start a new log | 65 // The function has no effect and returns false if we can't start a new log |
| 93 // e.g. because we are already logging or the file cannot be opened. | 66 // e.g. because we are already logging or the file cannot be opened. |
| 94 virtual bool StartLogging(const std::string& file_name, | 67 virtual bool StartLogging(const std::string& file_name, |
| 95 int64_t max_size_bytes) = 0; | 68 int64_t max_size_bytes) = 0; |
| 96 | 69 |
| 97 // Same as above. The RtcEventLog takes ownership of the file if the call | 70 // Same as above. The RtcEventLog takes ownership of the file if the call |
| 98 // is successful, i.e. if it returns true. | 71 // is successful, i.e. if it returns true. |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 int min_probes, | 204 int min_probes, |
| 232 int min_bytes) override{}; | 205 int min_bytes) override{}; |
| 233 void LogProbeResultSuccess(int id, int bitrate_bps) override{}; | 206 void LogProbeResultSuccess(int id, int bitrate_bps) override{}; |
| 234 void LogProbeResultFailure(int id, | 207 void LogProbeResultFailure(int id, |
| 235 ProbeFailureReason failure_reason) override{}; | 208 ProbeFailureReason failure_reason) override{}; |
| 236 }; | 209 }; |
| 237 | 210 |
| 238 } // namespace webrtc | 211 } // namespace webrtc |
| 239 | 212 |
| 240 #endif // WEBRTC_LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_H_ | 213 #endif // WEBRTC_LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_H_ |
| OLD | NEW |