Amit Hilbuch | a201204 | 2018-12-03 11:35:05 -0800 | [diff] [blame] | 1 | /* |
| 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 Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 11 | #ifndef PC_SDP_SERIALIZER_H_ |
| 12 | #define PC_SDP_SERIALIZER_H_ |
Amit Hilbuch | a201204 | 2018-12-03 11:35:05 -0800 | [diff] [blame] | 13 | |
| 14 | #include <string> |
| 15 | |
| 16 | #include "absl/strings/string_view.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 17 | #include "api/rtc_error.h" |
| 18 | #include "media/base/rid_description.h" |
| 19 | #include "pc/session_description.h" |
Amit Hilbuch | a201204 | 2018-12-03 11:35:05 -0800 | [diff] [blame] | 20 | |
| 21 | namespace webrtc { |
| 22 | |
| 23 | // This class should serialize components of the SDP (and not the SDP itself). |
| 24 | // Example: |
| 25 | // SimulcastDescription can be serialized and deserialized by this class. |
| 26 | // The serializer will know how to translate the data to spec-compliant |
| 27 | // format without knowing about the SDP attribute details (a=simulcast:) |
| 28 | // Usage: |
| 29 | // Consider the SDP attribute for simulcast a=simulcast:<configuration>. |
| 30 | // The SDP serializtion code (webrtcsdp.h) should use |SdpSerializer| to |
| 31 | // serialize and deserialize the <configuration> section. |
| 32 | // This class will allow testing the serialization of components without |
| 33 | // having to serialize the entire SDP while hiding implementation details |
| 34 | // from callers of sdp serialization (webrtcsdp.h). |
| 35 | class SdpSerializer { |
| 36 | public: |
| 37 | // Serialization for the Simulcast description according to |
| 38 | // https://tools.ietf.org/html/draft-ietf-mmusic-sdp-simulcast-13#section-5.1 |
| 39 | std::string SerializeSimulcastDescription( |
| 40 | const cricket::SimulcastDescription& simulcast) const; |
| 41 | |
| 42 | // Deserialization for the SimulcastDescription according to |
| 43 | // https://tools.ietf.org/html/draft-ietf-mmusic-sdp-simulcast-13#section-5.1 |
| 44 | RTCErrorOr<cricket::SimulcastDescription> DeserializeSimulcastDescription( |
| 45 | absl::string_view string) const; |
Amit Hilbuch | c57d573 | 2018-12-11 15:30:11 -0800 | [diff] [blame] | 46 | |
| 47 | // Serialization for the RID description according to |
| 48 | // https://tools.ietf.org/html/draft-ietf-mmusic-rid-15#section-10 |
| 49 | std::string SerializeRidDescription( |
| 50 | const cricket::RidDescription& rid_description) const; |
| 51 | |
| 52 | // Deserialization for the RidDescription according to |
| 53 | // https://tools.ietf.org/html/draft-ietf-mmusic-rid-15#section-10 |
| 54 | RTCErrorOr<cricket::RidDescription> DeserializeRidDescription( |
| 55 | absl::string_view string) const; |
Amit Hilbuch | a201204 | 2018-12-03 11:35:05 -0800 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | } // namespace webrtc |
| 59 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 60 | #endif // PC_SDP_SERIALIZER_H_ |