blob: 4811e5272d24e16674d8a67bdab9c40e4b29ff57 [file] [log] [blame]
Amit Hilbucha2012042018-12-03 19:35:051/*
2 * Copyright 2018 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
Philipp Hancke96bc0942023-09-14 15:23:5911#ifndef PC_SIMULCAST_SDP_SERIALIZER_H_
12#define PC_SIMULCAST_SDP_SERIALIZER_H_
Amit Hilbucha2012042018-12-03 19:35:0513
14#include <string>
15
16#include "absl/strings/string_view.h"
Steve Anton10542f22019-01-11 17:11:0017#include "api/rtc_error.h"
18#include "media/base/rid_description.h"
19#include "pc/session_description.h"
Harald Alvestrand5761e7b2021-01-29 14:45:0820#include "pc/simulcast_description.h"
Amit Hilbucha2012042018-12-03 19:35:0521
22namespace webrtc {
23
Philipp Hancke96bc0942023-09-14 15:23:5924// This class serializes simulcast components of the SDP.
Amit Hilbucha2012042018-12-03 19:35:0525// Example:
26// SimulcastDescription can be serialized and deserialized by this class.
27// The serializer will know how to translate the data to spec-compliant
28// format without knowing about the SDP attribute details (a=simulcast:)
29// Usage:
30// Consider the SDP attribute for simulcast a=simulcast:<configuration>.
Philipp Hancke96bc0942023-09-14 15:23:5931// The SDP serializtion code (webrtc_sdp.h) should use `SdpSerializer` to
Amit Hilbucha2012042018-12-03 19:35:0532// serialize and deserialize the <configuration> section.
33// This class will allow testing the serialization of components without
34// having to serialize the entire SDP while hiding implementation details
Philipp Hancke96bc0942023-09-14 15:23:5935// from callers of sdp serialization (webrtc_sdp.h).
36class SimulcastSdpSerializer {
Amit Hilbucha2012042018-12-03 19:35:0537 public:
38 // Serialization for the Simulcast description according to
39 // https://tools.ietf.org/html/draft-ietf-mmusic-sdp-simulcast-13#section-5.1
40 std::string SerializeSimulcastDescription(
41 const cricket::SimulcastDescription& simulcast) const;
42
43 // Deserialization for the SimulcastDescription according to
44 // https://tools.ietf.org/html/draft-ietf-mmusic-sdp-simulcast-13#section-5.1
45 RTCErrorOr<cricket::SimulcastDescription> DeserializeSimulcastDescription(
46 absl::string_view string) const;
Amit Hilbuchc57d5732018-12-11 23:30:1147
48 // Serialization for the RID description according to
49 // https://tools.ietf.org/html/draft-ietf-mmusic-rid-15#section-10
50 std::string SerializeRidDescription(
51 const cricket::RidDescription& rid_description) const;
52
53 // Deserialization for the RidDescription according to
54 // https://tools.ietf.org/html/draft-ietf-mmusic-rid-15#section-10
55 RTCErrorOr<cricket::RidDescription> DeserializeRidDescription(
56 absl::string_view string) const;
Amit Hilbucha2012042018-12-03 19:35:0557};
58
59} // namespace webrtc
60
Philipp Hancke96bc0942023-09-14 15:23:5961#endif // PC_SIMULCAST_SDP_SERIALIZER_H_