blob: 02bbdc6001caf3668e53f21fd68490efe92bc82c [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
ivoc112a3d82015-10-16 02:22:18 -070016#include "webrtc/base/platform_file.h"
Bjorn Terelius36411852015-07-30 12:45:18 +020017#include "webrtc/base/scoped_ptr.h"
18#include "webrtc/video_receive_stream.h"
19#include "webrtc/video_send_stream.h"
20
21namespace webrtc {
22
23// Forward declaration of storage class that is automatically generated from
24// the protobuf file.
25namespace rtclog {
26class EventStream;
27} // namespace rtclog
28
29class RtcEventLogImpl;
30
31enum class MediaType;
32
33class RtcEventLog {
34 public:
Bjorn Terelius36411852015-07-30 12:45:18 +020035 virtual ~RtcEventLog() {}
36
37 static rtc::scoped_ptr<RtcEventLog> Create();
38
39 // Starts logging for the specified duration to the specified file.
40 // The logging will stop automatically after the specified duration.
41 // If the file already exists it will be overwritten.
42 // If the file cannot be opened, the RtcEventLog will not start logging.
43 virtual void StartLogging(const std::string& file_name, int duration_ms) = 0;
44
ivoc112a3d82015-10-16 02:22:18 -070045 // Starts logging until either the 10 minute timer runs out or the StopLogging
46 // function is called. The RtcEventLog takes ownership of the supplied
47 // rtc::PlatformFile.
48 virtual bool StartLogging(rtc::PlatformFile log_file) = 0;
49
Bjorn Terelius36411852015-07-30 12:45:18 +020050 virtual void StopLogging() = 0;
51
52 // Logs configuration information for webrtc::VideoReceiveStream
53 virtual void LogVideoReceiveStreamConfig(
54 const webrtc::VideoReceiveStream::Config& config) = 0;
55
56 // Logs configuration information for webrtc::VideoSendStream
57 virtual void LogVideoSendStreamConfig(
58 const webrtc::VideoSendStream::Config& config) = 0;
59
terelius2f9fd5d2015-09-04 03:39:42 -070060 // Logs the header of an incoming or outgoing RTP packet. packet_length
61 // is the total length of the packet, including both header and payload.
Bjorn Terelius36411852015-07-30 12:45:18 +020062 virtual void LogRtpHeader(bool incoming,
63 MediaType media_type,
64 const uint8_t* header,
terelius2f9fd5d2015-09-04 03:39:42 -070065 size_t packet_length) = 0;
Bjorn Terelius36411852015-07-30 12:45:18 +020066
67 // Logs an incoming or outgoing RTCP packet.
68 virtual void LogRtcpPacket(bool incoming,
69 MediaType media_type,
70 const uint8_t* packet,
71 size_t length) = 0;
72
Ivo Creusenae856f22015-09-17 16:30:16 +020073 // Logs an audio playout event
74 virtual void LogAudioPlayout(uint32_t ssrc) = 0;
Bjorn Terelius36411852015-07-30 12:45:18 +020075
76 // Reads an RtcEventLog file and returns true when reading was successful.
77 // The result is stored in the given EventStream object.
78 static bool ParseRtcEventLog(const std::string& file_name,
79 rtclog::EventStream* result);
80};
81
82} // namespace webrtc
83
Peter Boström5c389d32015-09-25 13:58:30 +020084#endif // WEBRTC_CALL_RTC_EVENT_LOG_H_