blob: 33c530789bbe2ee7b691e5ccb1c0906e6657814d [file] [log] [blame]
Elad Alon1d87b0e2017-10-03 13:01:031/*
2 * Copyright (c) 2017 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 LOGGING_RTC_EVENT_LOG_ENCODER_RTC_EVENT_LOG_ENCODER_LEGACY_H_
12#define LOGGING_RTC_EVENT_LOG_ENCODER_RTC_EVENT_LOG_ENCODER_LEGACY_H_
13
Bjorn Terelius5cab6f12017-12-14 18:06:4114#include <deque>
Elad Alon1d87b0e2017-10-03 13:01:0315#include <memory>
16#include <string>
17
Danil Chapovalov6e661f42021-05-10 15:19:5018#include "api/array_view.h"
Elad Alon1d87b0e2017-10-03 13:01:0319#include "logging/rtc_event_log/encoder/rtc_event_log_encoder.h"
20#include "rtc_base/buffer.h"
21
Elad Alon1d87b0e2017-10-03 13:01:0322namespace webrtc {
23
24namespace rtclog {
25class Event; // Auto-generated from protobuf.
26} // namespace rtclog
27
Björn Terelius12053ec2022-08-10 13:24:3428class RtcEventAlrState;
Elad Alon1d87b0e2017-10-03 13:01:0329class RtcEventAudioNetworkAdaptation;
30class RtcEventAudioPlayout;
31class RtcEventAudioReceiveStreamConfig;
32class RtcEventAudioSendStreamConfig;
33class RtcEventBweUpdateDelayBased;
34class RtcEventBweUpdateLossBased;
Qingsi Wang8eca1ff2018-02-02 19:49:4435class RtcEventIceCandidatePairConfig;
36class RtcEventIceCandidatePair;
Elad Alon1d87b0e2017-10-03 13:01:0337class RtcEventLoggingStarted;
38class RtcEventLoggingStopped;
39class RtcEventProbeClusterCreated;
40class RtcEventProbeResultFailure;
41class RtcEventProbeResultSuccess;
Björn Terelius12053ec2022-08-10 13:24:3442class RtcEventRemoteEstimate;
Elad Alon1d87b0e2017-10-03 13:01:0343class RtcEventRtcpPacketIncoming;
44class RtcEventRtcpPacketOutgoing;
45class RtcEventRtpPacketIncoming;
46class RtcEventRtpPacketOutgoing;
47class RtcEventVideoReceiveStreamConfig;
48class RtcEventVideoSendStreamConfig;
49class RtpPacket;
50
51class RtcEventLogEncoderLegacy final : public RtcEventLogEncoder {
52 public:
53 ~RtcEventLogEncoderLegacy() override = default;
54
Bjorn Tereliuse78b4652018-11-13 10:19:1855 std::string EncodeLogStart(int64_t timestamp_us,
56 int64_t utc_time_us) override;
Bjorn Terelius8e126fc2017-12-18 13:21:5357 std::string EncodeLogEnd(int64_t timestamp_us) override;
58
Bjorn Terelius5cab6f12017-12-14 18:06:4159 std::string EncodeBatch(
60 std::deque<std::unique_ptr<RtcEvent>>::const_iterator begin,
61 std::deque<std::unique_ptr<RtcEvent>>::const_iterator end) override;
62
Elad Alon1d87b0e2017-10-03 13:01:0363 private:
Bjorn Terelius07b35bc2018-01-19 14:39:3964 std::string Encode(const RtcEvent& event);
Elad Alon1d87b0e2017-10-03 13:01:0365 // Encoding entry-point for the various RtcEvent subclasses.
Ilya Nikolaevskiya4259f62017-12-05 12:19:4566 std::string EncodeAlrState(const RtcEventAlrState& event);
Elad Alon1d87b0e2017-10-03 13:01:0367 std::string EncodeAudioNetworkAdaptation(
68 const RtcEventAudioNetworkAdaptation& event);
69 std::string EncodeAudioPlayout(const RtcEventAudioPlayout& event);
70 std::string EncodeAudioReceiveStreamConfig(
71 const RtcEventAudioReceiveStreamConfig& event);
72 std::string EncodeAudioSendStreamConfig(
73 const RtcEventAudioSendStreamConfig& event);
74 std::string EncodeBweUpdateDelayBased(
75 const RtcEventBweUpdateDelayBased& event);
76 std::string EncodeBweUpdateLossBased(const RtcEventBweUpdateLossBased& event);
Qingsi Wang8eca1ff2018-02-02 19:49:4477 std::string EncodeIceCandidatePairConfig(
78 const RtcEventIceCandidatePairConfig& event);
79 std::string EncodeIceCandidatePairEvent(
80 const RtcEventIceCandidatePair& event);
Elad Alon1d87b0e2017-10-03 13:01:0381 std::string EncodeProbeClusterCreated(
82 const RtcEventProbeClusterCreated& event);
83 std::string EncodeProbeResultFailure(const RtcEventProbeResultFailure& event);
84 std::string EncodeProbeResultSuccess(const RtcEventProbeResultSuccess&);
Björn Terelius12053ec2022-08-10 13:24:3485 std::string EncodeRemoteEstimate(const RtcEventRemoteEstimate& event);
Elad Alon1d87b0e2017-10-03 13:01:0386 std::string EncodeRtcpPacketIncoming(const RtcEventRtcpPacketIncoming& event);
87 std::string EncodeRtcpPacketOutgoing(const RtcEventRtcpPacketOutgoing& event);
88 std::string EncodeRtpPacketIncoming(const RtcEventRtpPacketIncoming& event);
89 std::string EncodeRtpPacketOutgoing(const RtcEventRtpPacketOutgoing& event);
90 std::string EncodeVideoReceiveStreamConfig(
91 const RtcEventVideoReceiveStreamConfig& event);
92 std::string EncodeVideoSendStreamConfig(
93 const RtcEventVideoSendStreamConfig& event);
94
95 // RTCP/RTP are handled similarly for incoming/outgoing.
96 std::string EncodeRtcpPacket(int64_t timestamp_us,
97 const rtc::Buffer& packet,
98 bool is_incoming);
99 std::string EncodeRtpPacket(int64_t timestamp_us,
Danil Chapovalov6e661f42021-05-10 15:19:50100 rtc::ArrayView<const uint8_t> header,
Elad Alon1d87b0e2017-10-03 13:01:03101 size_t packet_length,
102 int probe_cluster_id,
103 bool is_incoming);
104
105 std::string Serialize(rtclog::Event* event);
106};
107
108} // namespace webrtc
109
Elad Alon1d87b0e2017-10-03 13:01:03110#endif // LOGGING_RTC_EVENT_LOG_ENCODER_RTC_EVENT_LOG_ENCODER_LEGACY_H_