Bjorn Terelius | 3641185 | 2015-07-30 12:45:18 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Peter Boström | 5c389d3 | 2015-09-25 13:58:30 +0200 | [diff] [blame^] | 11 | #ifndef WEBRTC_CALL_RTC_EVENT_LOG_H_ |
| 12 | #define WEBRTC_CALL_RTC_EVENT_LOG_H_ |
Bjorn Terelius | 3641185 | 2015-07-30 12:45:18 +0200 | [diff] [blame] | 13 | |
| 14 | #include <string> |
| 15 | |
| 16 | #include "webrtc/base/scoped_ptr.h" |
| 17 | #include "webrtc/video_receive_stream.h" |
| 18 | #include "webrtc/video_send_stream.h" |
| 19 | |
| 20 | namespace webrtc { |
| 21 | |
| 22 | // Forward declaration of storage class that is automatically generated from |
| 23 | // the protobuf file. |
| 24 | namespace rtclog { |
| 25 | class EventStream; |
| 26 | } // namespace rtclog |
| 27 | |
| 28 | class RtcEventLogImpl; |
| 29 | |
| 30 | enum class MediaType; |
| 31 | |
| 32 | class RtcEventLog { |
| 33 | public: |
Bjorn Terelius | 3641185 | 2015-07-30 12:45:18 +0200 | [diff] [blame] | 34 | virtual ~RtcEventLog() {} |
| 35 | |
| 36 | static rtc::scoped_ptr<RtcEventLog> Create(); |
| 37 | |
| 38 | // Starts logging for the specified duration to the specified file. |
| 39 | // The logging will stop automatically after the specified duration. |
| 40 | // If the file already exists it will be overwritten. |
| 41 | // If the file cannot be opened, the RtcEventLog will not start logging. |
| 42 | virtual void StartLogging(const std::string& file_name, int duration_ms) = 0; |
| 43 | |
| 44 | virtual void StopLogging() = 0; |
| 45 | |
| 46 | // Logs configuration information for webrtc::VideoReceiveStream |
| 47 | virtual void LogVideoReceiveStreamConfig( |
| 48 | const webrtc::VideoReceiveStream::Config& config) = 0; |
| 49 | |
| 50 | // Logs configuration information for webrtc::VideoSendStream |
| 51 | virtual void LogVideoSendStreamConfig( |
| 52 | const webrtc::VideoSendStream::Config& config) = 0; |
| 53 | |
terelius | 2f9fd5d | 2015-09-04 03:39:42 -0700 | [diff] [blame] | 54 | // Logs the header of an incoming or outgoing RTP packet. packet_length |
| 55 | // is the total length of the packet, including both header and payload. |
Bjorn Terelius | 3641185 | 2015-07-30 12:45:18 +0200 | [diff] [blame] | 56 | virtual void LogRtpHeader(bool incoming, |
| 57 | MediaType media_type, |
| 58 | const uint8_t* header, |
terelius | 2f9fd5d | 2015-09-04 03:39:42 -0700 | [diff] [blame] | 59 | size_t packet_length) = 0; |
Bjorn Terelius | 3641185 | 2015-07-30 12:45:18 +0200 | [diff] [blame] | 60 | |
| 61 | // Logs an incoming or outgoing RTCP packet. |
| 62 | virtual void LogRtcpPacket(bool incoming, |
| 63 | MediaType media_type, |
| 64 | const uint8_t* packet, |
| 65 | size_t length) = 0; |
| 66 | |
Ivo Creusen | ae856f2 | 2015-09-17 16:30:16 +0200 | [diff] [blame] | 67 | // Logs an audio playout event |
| 68 | virtual void LogAudioPlayout(uint32_t ssrc) = 0; |
Bjorn Terelius | 3641185 | 2015-07-30 12:45:18 +0200 | [diff] [blame] | 69 | |
| 70 | // Reads an RtcEventLog file and returns true when reading was successful. |
| 71 | // The result is stored in the given EventStream object. |
| 72 | static bool ParseRtcEventLog(const std::string& file_name, |
| 73 | rtclog::EventStream* result); |
| 74 | }; |
| 75 | |
| 76 | } // namespace webrtc |
| 77 | |
Peter Boström | 5c389d3 | 2015-09-25 13:58:30 +0200 | [diff] [blame^] | 78 | #endif // WEBRTC_CALL_RTC_EVENT_LOG_H_ |