Amit Hilbuch | a201204 | 2018-12-03 19:35:05 | [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 | |
Philipp Hancke | 96bc094 | 2023-09-14 15:23:59 | [diff] [blame] | 11 | #ifndef PC_SIMULCAST_SDP_SERIALIZER_H_ |
| 12 | #define PC_SIMULCAST_SDP_SERIALIZER_H_ |
Amit Hilbuch | a201204 | 2018-12-03 19:35:05 | [diff] [blame] | 13 | |
| 14 | #include <string> |
| 15 | |
| 16 | #include "absl/strings/string_view.h" |
Steve Anton | 10542f2 | 2019-01-11 17:11:00 | [diff] [blame] | 17 | #include "api/rtc_error.h" |
| 18 | #include "media/base/rid_description.h" |
| 19 | #include "pc/session_description.h" |
Harald Alvestrand | 5761e7b | 2021-01-29 14:45:08 | [diff] [blame] | 20 | #include "pc/simulcast_description.h" |
Amit Hilbuch | a201204 | 2018-12-03 19:35:05 | [diff] [blame] | 21 | |
| 22 | namespace webrtc { |
| 23 | |
Philipp Hancke | 96bc094 | 2023-09-14 15:23:59 | [diff] [blame] | 24 | // This class serializes simulcast components of the SDP. |
Amit Hilbuch | a201204 | 2018-12-03 19:35:05 | [diff] [blame] | 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>. |
Philipp Hancke | 96bc094 | 2023-09-14 15:23:59 | [diff] [blame] | 31 | // The SDP serializtion code (webrtc_sdp.h) should use `SdpSerializer` to |
Amit Hilbuch | a201204 | 2018-12-03 19:35:05 | [diff] [blame] | 32 | // 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 Hancke | 96bc094 | 2023-09-14 15:23:59 | [diff] [blame] | 35 | // from callers of sdp serialization (webrtc_sdp.h). |
| 36 | class SimulcastSdpSerializer { |
Amit Hilbuch | a201204 | 2018-12-03 19:35:05 | [diff] [blame] | 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 Hilbuch | c57d573 | 2018-12-11 23:30:11 | [diff] [blame] | 47 | |
| 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 Hilbuch | a201204 | 2018-12-03 19:35:05 | [diff] [blame] | 57 | }; |
| 58 | |
| 59 | } // namespace webrtc |
| 60 | |
Philipp Hancke | 96bc094 | 2023-09-14 15:23:59 | [diff] [blame] | 61 | #endif // PC_SIMULCAST_SDP_SERIALIZER_H_ |