• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CAST_STREAMING_SESSION_CONFIG_H_
6 #define CAST_STREAMING_SESSION_CONFIG_H_
7 
8 #include <array>
9 #include <chrono>
10 #include <cstdint>
11 
12 #include "cast/streaming/ssrc.h"
13 
14 namespace openscreen {
15 namespace cast {
16 
17 // Common streaming configuration, established from the OFFER/ANSWER exchange,
18 // that the Sender and Receiver are both assuming.
19 // TODO(jophba): add config validation.
20 struct SessionConfig final {
21   SessionConfig(Ssrc sender_ssrc,
22                 Ssrc receiver_ssrc,
23                 int rtp_timebase,
24                 int channels,
25                 std::chrono::milliseconds target_playout_delay,
26                 std::array<uint8_t, 16> aes_secret_key,
27                 std::array<uint8_t, 16> aes_iv_mask,
28                 bool is_pli_enabled);
29   SessionConfig(const SessionConfig& other);
30   SessionConfig(SessionConfig&& other) noexcept;
31   SessionConfig& operator=(const SessionConfig& other);
32   SessionConfig& operator=(SessionConfig&& other) noexcept;
33   ~SessionConfig();
34 
35   // The sender and receiver's SSRC identifiers. Note: SSRC identifiers
36   // are defined as unsigned 32 bit integers here:
37   // https://tools.ietf.org/html/rfc5576#page-5
38   Ssrc sender_ssrc = 0;
39   Ssrc receiver_ssrc = 0;
40 
41   // RTP timebase: The number of RTP units advanced per second. For audio,
42   // this is the sampling rate. For video, this is 90 kHz by convention.
43   int rtp_timebase = 90000;
44 
45   // Number of channels. Must be 1 for video, for audio typically 2.
46   int channels = 1;
47 
48   // Initial target playout delay.
49   std::chrono::milliseconds target_playout_delay;
50 
51   // The AES-128 crypto key and initialization vector.
52   std::array<uint8_t, 16> aes_secret_key{};
53   std::array<uint8_t, 16> aes_iv_mask{};
54 
55   // Whether picture loss indication (PLI) should be used for this session.
56   bool is_pli_enabled = false;
57 };
58 
59 }  // namespace cast
60 }  // namespace openscreen
61 
62 #endif  // CAST_STREAMING_SESSION_CONFIG_H_
63