blob: a6bf2e3d8836d2b7e0ee6f0ca702f56ffc48c366 [file] [log] [blame]
Bjorn Terelius36411852015-07-30 12:45:18 +02001/*
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
11#ifndef WEBRTC_VIDEO_RTC_EVENT_LOG_H_
12#define WEBRTC_VIDEO_RTC_EVENT_LOG_H_
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
20namespace webrtc {
21
22// Forward declaration of storage class that is automatically generated from
23// the protobuf file.
24namespace rtclog {
25class EventStream;
26} // namespace rtclog
27
28class RtcEventLogImpl;
29
30enum class MediaType;
31
32class RtcEventLog {
33 public:
34 // The types of debug events that are currently supported for logging.
35 enum class DebugEvent { kLogStart, kLogEnd, kAudioPlayout };
36
37 virtual ~RtcEventLog() {}
38
39 static rtc::scoped_ptr<RtcEventLog> Create();
40
41 // Starts logging for the specified duration to the specified file.
42 // The logging will stop automatically after the specified duration.
43 // If the file already exists it will be overwritten.
44 // If the file cannot be opened, the RtcEventLog will not start logging.
45 virtual void StartLogging(const std::string& file_name, int duration_ms) = 0;
46
47 virtual void StopLogging() = 0;
48
49 // Logs configuration information for webrtc::VideoReceiveStream
50 virtual void LogVideoReceiveStreamConfig(
51 const webrtc::VideoReceiveStream::Config& config) = 0;
52
53 // Logs configuration information for webrtc::VideoSendStream
54 virtual void LogVideoSendStreamConfig(
55 const webrtc::VideoSendStream::Config& config) = 0;
56
57 // Logs the header of an incoming or outgoing RTP packet.
58 virtual void LogRtpHeader(bool incoming,
59 MediaType media_type,
60 const uint8_t* header,
61 size_t header_length,
62 size_t total_length) = 0;
63
64 // Logs an incoming or outgoing RTCP packet.
65 virtual void LogRtcpPacket(bool incoming,
66 MediaType media_type,
67 const uint8_t* packet,
68 size_t length) = 0;
69
70 // Logs a debug event.
71 virtual void LogDebugEvent(DebugEvent event_type) = 0;
72
73 // Reads an RtcEventLog file and returns true when reading was successful.
74 // The result is stored in the given EventStream object.
75 static bool ParseRtcEventLog(const std::string& file_name,
76 rtclog::EventStream* result);
77};
78
79} // namespace webrtc
80
81#endif // WEBRTC_VIDEO_RTC_EVENT_LOG_H_