blob: 1223cd1af7a6e94880bd900ae2b8915cd90fbf68 [file] [log] [blame]
Amit Hilbucha2012042018-12-03 11:35:05 -08001/*
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
Steve Anton10542f22019-01-11 09:11:00 -080011#ifndef PC_SDP_SERIALIZER_H_
12#define PC_SDP_SERIALIZER_H_
Amit Hilbucha2012042018-12-03 11:35:05 -080013
14#include <string>
15
16#include "absl/strings/string_view.h"
Steve Anton10542f22019-01-11 09:11:00 -080017#include "api/rtc_error.h"
18#include "media/base/rid_description.h"
19#include "pc/session_description.h"
Harald Alvestrand5761e7b2021-01-29 14:45:08 +000020#include "pc/simulcast_description.h"
Amit Hilbucha2012042018-12-03 11:35:05 -080021
22namespace webrtc {
23
24// This class should serialize components of the SDP (and not the SDP itself).
25// 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>.
Björn Tereliusfd05d6f2021-07-27 22:09:55 +000031// The SDP serializtion code (webrtcsdp.h) should use |SdpSerializer| to
Amit Hilbucha2012042018-12-03 11:35:05 -080032// 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
35// from callers of sdp serialization (webrtcsdp.h).
36class SdpSerializer {
37 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 15:30:11 -080047
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 11:35:05 -080057};
58
59} // namespace webrtc
60
Steve Anton10542f22019-01-11 09:11:00 -080061#endif // PC_SDP_SERIALIZER_H_