blob: 428b4209c902c899de94a6987a091d012e81567e [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
11#ifndef PC_SDPSERIALIZER_H_
12#define PC_SDPSERIALIZER_H_
13
14#include <string>
15
16#include "absl/strings/string_view.h"
17#include "api/rtcerror.h"
18#include "pc/sessiondescription.h"
19
20namespace webrtc {
21
22// This class should serialize components of the SDP (and not the SDP itself).
23// Example:
24// SimulcastDescription can be serialized and deserialized by this class.
25// The serializer will know how to translate the data to spec-compliant
26// format without knowing about the SDP attribute details (a=simulcast:)
27// Usage:
28// Consider the SDP attribute for simulcast a=simulcast:<configuration>.
29// The SDP serializtion code (webrtcsdp.h) should use |SdpSerializer| to
30// serialize and deserialize the <configuration> section.
31// This class will allow testing the serialization of components without
32// having to serialize the entire SDP while hiding implementation details
33// from callers of sdp serialization (webrtcsdp.h).
34class SdpSerializer {
35 public:
36 // Serialization for the Simulcast description according to
37 // https://tools.ietf.org/html/draft-ietf-mmusic-sdp-simulcast-13#section-5.1
38 std::string SerializeSimulcastDescription(
39 const cricket::SimulcastDescription& simulcast) const;
40
41 // Deserialization for the SimulcastDescription according to
42 // https://tools.ietf.org/html/draft-ietf-mmusic-sdp-simulcast-13#section-5.1
43 RTCErrorOr<cricket::SimulcastDescription> DeserializeSimulcastDescription(
44 absl::string_view string) const;
45};
46
47} // namespace webrtc
48
49#endif // PC_SDPSERIALIZER_H_