1 /* 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_EVENTS_RTC_EVENT_AUDIO_SEND_STREAM_CONFIG_H_ 12 #define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_AUDIO_SEND_STREAM_CONFIG_H_ 13 14 #include <memory> 15 #include <string> 16 #include <vector> 17 18 #include "absl/strings/string_view.h" 19 #include "api/rtc_event_log/rtc_event.h" 20 #include "logging/rtc_event_log/events/rtc_event_field_encoding_parser.h" 21 #include "logging/rtc_event_log/rtc_stream_config.h" 22 23 namespace webrtc { 24 25 struct LoggedAudioSendConfig { 26 LoggedAudioSendConfig() = default; LoggedAudioSendConfigLoggedAudioSendConfig27 LoggedAudioSendConfig(Timestamp timestamp, const rtclog::StreamConfig config) 28 : timestamp(timestamp), config(config) {} 29 log_time_usLoggedAudioSendConfig30 int64_t log_time_us() const { return timestamp.us(); } log_time_msLoggedAudioSendConfig31 int64_t log_time_ms() const { return timestamp.ms(); } log_timeLoggedAudioSendConfig32 Timestamp log_time() const { return timestamp; } 33 34 Timestamp timestamp = Timestamp::MinusInfinity(); 35 rtclog::StreamConfig config; 36 }; 37 38 class RtcEventAudioSendStreamConfig final : public RtcEvent { 39 public: 40 static constexpr Type kType = Type::AudioSendStreamConfig; 41 42 explicit RtcEventAudioSendStreamConfig( 43 std::unique_ptr<rtclog::StreamConfig> config); 44 ~RtcEventAudioSendStreamConfig() override; 45 GetType()46 Type GetType() const override { return kType; } IsConfigEvent()47 bool IsConfigEvent() const override { return true; } 48 49 std::unique_ptr<RtcEventAudioSendStreamConfig> Copy() const; 50 config()51 const rtclog::StreamConfig& config() const { return *config_; } 52 Encode(rtc::ArrayView<const RtcEvent * > batch)53 static std::string Encode(rtc::ArrayView<const RtcEvent*> batch) { 54 // TODO(terelius): Implement 55 return ""; 56 } 57 Parse(absl::string_view encoded_bytes,bool batched,std::vector<LoggedAudioSendConfig> & output)58 static RtcEventLogParseStatus Parse( 59 absl::string_view encoded_bytes, 60 bool batched, 61 std::vector<LoggedAudioSendConfig>& output) { 62 // TODO(terelius): Implement 63 return RtcEventLogParseStatus::Error("Not Implemented", __FILE__, __LINE__); 64 } 65 66 private: 67 RtcEventAudioSendStreamConfig(const RtcEventAudioSendStreamConfig& other); 68 69 const std::unique_ptr<const rtclog::StreamConfig> config_; 70 }; 71 72 } // namespace webrtc 73 74 #endif // LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_AUDIO_SEND_STREAM_CONFIG_H_ 75