aboutsummaryrefslogtreecommitdiff
path: root/cast/streaming/rtcp_session.h
blob: d896cb946bdc2f3ba06d0599ae883e9a87b06f01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CAST_STREAMING_RTCP_SESSION_H_
#define CAST_STREAMING_RTCP_SESSION_H_

#include "cast/streaming/ntp_time.h"
#include "cast/streaming/ssrc.h"

namespace cast {
namespace streaming {

// Session-level configuration and shared components for the RTCP messaging
// associated with a single Cast RTP stream. Multiple packet serialization and
// parsing components share a single RtcpSession instance for data consistency.
class RtcpSession {
 public:
  // |start_time| should be the current time, as it is used by NtpTimeConverter
  // to set a fixed reference point between the local Clock and current "real
  // world" wall time.
  RtcpSession(Ssrc sender_ssrc,
              Ssrc receiver_ssrc,
              openscreen::platform::Clock::time_point start_time);
  ~RtcpSession();

  Ssrc sender_ssrc() const { return sender_ssrc_; }
  Ssrc receiver_ssrc() const { return receiver_ssrc_; }
  const NtpTimeConverter& ntp_converter() const { return ntp_converter_; }

 private:
  const Ssrc sender_ssrc_;
  const Ssrc receiver_ssrc_;

  // Translates between system time (internal format) and NTP (wire format).
  NtpTimeConverter ntp_converter_;
};

}  // namespace streaming
}  // namespace cast

#endif  // CAST_STREAMING_RTCP_SESSION_H_