• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_RECEIVE_STREAM_CONFIG_H_
12 #define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_AUDIO_RECEIVE_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 "api/units/timestamp.h"
21 #include "logging/rtc_event_log/events/rtc_event_field_encoding_parser.h"
22 #include "logging/rtc_event_log/rtc_stream_config.h"
23 
24 namespace webrtc {
25 
26 struct LoggedAudioRecvConfig {
27   LoggedAudioRecvConfig() = default;
LoggedAudioRecvConfigLoggedAudioRecvConfig28   LoggedAudioRecvConfig(Timestamp timestamp, const rtclog::StreamConfig config)
29       : timestamp(timestamp), config(config) {}
30 
log_time_usLoggedAudioRecvConfig31   int64_t log_time_us() const { return timestamp.us(); }
log_time_msLoggedAudioRecvConfig32   int64_t log_time_ms() const { return timestamp.ms(); }
log_timeLoggedAudioRecvConfig33   Timestamp log_time() const { return timestamp; }
34 
35   Timestamp timestamp = Timestamp::MinusInfinity();
36   rtclog::StreamConfig config;
37 };
38 
39 class RtcEventAudioReceiveStreamConfig final : public RtcEvent {
40  public:
41   static constexpr Type kType = Type::AudioReceiveStreamConfig;
42 
43   explicit RtcEventAudioReceiveStreamConfig(
44       std::unique_ptr<rtclog::StreamConfig> config);
45   ~RtcEventAudioReceiveStreamConfig() override;
46 
GetType()47   Type GetType() const override { return kType; }
IsConfigEvent()48   bool IsConfigEvent() const override { return true; }
49 
50   std::unique_ptr<RtcEventAudioReceiveStreamConfig> Copy() const;
51 
config()52   const rtclog::StreamConfig& config() const { return *config_; }
53 
Encode(rtc::ArrayView<const RtcEvent * > batch)54   static std::string Encode(rtc::ArrayView<const RtcEvent*> batch) {
55     // TODO(terelius): Implement
56     return "";
57   }
58 
Parse(absl::string_view encoded_bytes,bool batched,std::vector<LoggedAudioRecvConfig> & output)59   static RtcEventLogParseStatus Parse(
60       absl::string_view encoded_bytes,
61       bool batched,
62       std::vector<LoggedAudioRecvConfig>& output) {
63     // TODO(terelius): Implement
64     return RtcEventLogParseStatus::Error("Not Implemented", __FILE__, __LINE__);
65   }
66 
67  private:
68   RtcEventAudioReceiveStreamConfig(
69       const RtcEventAudioReceiveStreamConfig& other);
70 
71   const std::unique_ptr<const rtclog::StreamConfig> config_;
72 };
73 
74 }  // namespace webrtc
75 
76 #endif  // LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_AUDIO_RECEIVE_STREAM_CONFIG_H_
77