blob: a4b7cadadb7c3970865380866cbf320805773175 [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
Peter Boström5c389d32015-09-25 13:58:30 +020011#ifndef WEBRTC_CALL_RTC_EVENT_LOG_H_
12#define WEBRTC_CALL_RTC_EVENT_LOG_H_
Bjorn Terelius36411852015-07-30 12:45:18 +020013
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:
Bjorn Terelius36411852015-07-30 12:45:18 +020034 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
terelius2f9fd5d2015-09-04 03:39:42 -070054 // 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 Terelius36411852015-07-30 12:45:18 +020056 virtual void LogRtpHeader(bool incoming,
57 MediaType media_type,
58 const uint8_t* header,
terelius2f9fd5d2015-09-04 03:39:42 -070059 size_t packet_length) = 0;
Bjorn Terelius36411852015-07-30 12:45:18 +020060
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 Creusenae856f22015-09-17 16:30:16 +020067 // Logs an audio playout event
68 virtual void LogAudioPlayout(uint32_t ssrc) = 0;
Bjorn Terelius36411852015-07-30 12:45:18 +020069
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öm5c389d32015-09-25 13:58:30 +020078#endif // WEBRTC_CALL_RTC_EVENT_LOG_H_