mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
Rename simulcast SDP serializer
which is not a generic SDP serializer but only deals with the simulcast SDP. BUG=None Change-Id: I6bed6ada28ad5b96f07fd7670ad3d635bd4bc732 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/320280 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Philipp Hancke <phancke@microsoft.com> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#40761}
This commit is contained in:
parent
17304c3bf8
commit
96bc094d38
5 changed files with 30 additions and 29 deletions
14
pc/BUILD.gn
14
pc/BUILD.gn
|
@ -764,11 +764,11 @@ rtc_source_set("peerconnection") {
|
|||
":rtp_transmission_manager",
|
||||
":sctp_data_channel",
|
||||
":sdp_offer_answer",
|
||||
":sdp_serializer",
|
||||
":sdp_state_provider",
|
||||
":sdp_utils",
|
||||
":session_description",
|
||||
":simulcast_description",
|
||||
":simulcast_sdp_serializer",
|
||||
":stream_collection",
|
||||
":track_media_info_map",
|
||||
":transceiver_list",
|
||||
|
@ -1259,11 +1259,11 @@ rtc_source_set("peer_connection") {
|
|||
]
|
||||
}
|
||||
|
||||
rtc_source_set("sdp_serializer") {
|
||||
rtc_source_set("simulcast_sdp_serializer") {
|
||||
visibility = [ ":*" ]
|
||||
sources = [
|
||||
"sdp_serializer.cc",
|
||||
"sdp_serializer.h",
|
||||
"simulcast_sdp_serializer.cc",
|
||||
"simulcast_sdp_serializer.h",
|
||||
]
|
||||
deps = [
|
||||
":session_description",
|
||||
|
@ -1383,9 +1383,9 @@ rtc_source_set("webrtc_sdp") {
|
|||
deps = [
|
||||
":media_protocol_names",
|
||||
":media_session",
|
||||
":sdp_serializer",
|
||||
":session_description",
|
||||
":simulcast_description",
|
||||
":simulcast_sdp_serializer",
|
||||
"../api:candidate",
|
||||
"../api:libjingle_peerconnection_api",
|
||||
"../api:rtc_error",
|
||||
|
@ -2341,7 +2341,7 @@ if (rtc_include_tests && !build_with_chromium) {
|
|||
"rtp_transceiver_unittest.cc",
|
||||
"sctp_utils_unittest.cc",
|
||||
"sdp_offer_answer_unittest.cc",
|
||||
"sdp_serializer_unittest.cc",
|
||||
"simulcast_sdp_serializer_unittest.cc",
|
||||
"test/fake_audio_capture_module_unittest.cc",
|
||||
"test/test_sdp_strings.h",
|
||||
"track_media_info_map_unittest.cc",
|
||||
|
@ -2383,10 +2383,10 @@ if (rtc_include_tests && !build_with_chromium) {
|
|||
":sctp_data_channel",
|
||||
":sctp_transport",
|
||||
":sctp_utils",
|
||||
":sdp_serializer",
|
||||
":sdp_utils",
|
||||
":session_description",
|
||||
":simulcast_description",
|
||||
":simulcast_sdp_serializer",
|
||||
":stream_collection",
|
||||
":track_media_info_map",
|
||||
":transport_stats",
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "pc/sdp_serializer.h"
|
||||
#include "pc/simulcast_sdp_serializer.h"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
@ -181,7 +181,7 @@ webrtc::RTCError ParseRidPayloadList(const std::string& payload_list,
|
|||
|
||||
} // namespace
|
||||
|
||||
std::string SdpSerializer::SerializeSimulcastDescription(
|
||||
std::string SimulcastSdpSerializer::SerializeSimulcastDescription(
|
||||
const cricket::SimulcastDescription& simulcast) const {
|
||||
rtc::StringBuilder sb;
|
||||
std::string delimiter;
|
||||
|
@ -210,7 +210,8 @@ std::string SdpSerializer::SerializeSimulcastDescription(
|
|||
// sc-id-paused = "~"
|
||||
// sc-id = [sc-id-paused] rid-id
|
||||
// rid-id = 1*(alpha-numeric / "-" / "_") ; see: I-D.ietf-mmusic-rid
|
||||
RTCErrorOr<SimulcastDescription> SdpSerializer::DeserializeSimulcastDescription(
|
||||
RTCErrorOr<SimulcastDescription>
|
||||
SimulcastSdpSerializer::DeserializeSimulcastDescription(
|
||||
absl::string_view string) const {
|
||||
std::vector<std::string> tokens;
|
||||
rtc::tokenize(std::string(string), kDelimiterSpaceChar, &tokens);
|
||||
|
@ -264,7 +265,7 @@ RTCErrorOr<SimulcastDescription> SdpSerializer::DeserializeSimulcastDescription(
|
|||
return std::move(simulcast);
|
||||
}
|
||||
|
||||
std::string SdpSerializer::SerializeRidDescription(
|
||||
std::string SimulcastSdpSerializer::SerializeRidDescription(
|
||||
const RidDescription& rid_description) const {
|
||||
RTC_DCHECK(!rid_description.rid.empty());
|
||||
RTC_DCHECK(rid_description.direction == RidDirection::kSend ||
|
||||
|
@ -319,7 +320,7 @@ std::string SdpSerializer::SerializeRidDescription(
|
|||
// rid-param = 1*(alpha-numeric / "-") [ "=" param-val ]
|
||||
// param-val = *( %x20-58 / %x60-7E )
|
||||
// ; Any printable character except semicolon
|
||||
RTCErrorOr<RidDescription> SdpSerializer::DeserializeRidDescription(
|
||||
RTCErrorOr<RidDescription> SimulcastSdpSerializer::DeserializeRidDescription(
|
||||
absl::string_view string) const {
|
||||
std::vector<std::string> tokens;
|
||||
rtc::tokenize(std::string(string), kDelimiterSpaceChar, &tokens);
|
|
@ -8,8 +8,8 @@
|
|||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef PC_SDP_SERIALIZER_H_
|
||||
#define PC_SDP_SERIALIZER_H_
|
||||
#ifndef PC_SIMULCAST_SDP_SERIALIZER_H_
|
||||
#define PC_SIMULCAST_SDP_SERIALIZER_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
|
@ -21,19 +21,19 @@
|
|||
|
||||
namespace webrtc {
|
||||
|
||||
// This class should serialize components of the SDP (and not the SDP itself).
|
||||
// This class serializes simulcast components of the SDP.
|
||||
// Example:
|
||||
// SimulcastDescription can be serialized and deserialized by this class.
|
||||
// The serializer will know how to translate the data to spec-compliant
|
||||
// format without knowing about the SDP attribute details (a=simulcast:)
|
||||
// Usage:
|
||||
// Consider the SDP attribute for simulcast a=simulcast:<configuration>.
|
||||
// The SDP serializtion code (webrtcsdp.h) should use `SdpSerializer` to
|
||||
// The SDP serializtion code (webrtc_sdp.h) should use `SdpSerializer` to
|
||||
// serialize and deserialize the <configuration> section.
|
||||
// This class will allow testing the serialization of components without
|
||||
// having to serialize the entire SDP while hiding implementation details
|
||||
// from callers of sdp serialization (webrtcsdp.h).
|
||||
class SdpSerializer {
|
||||
// from callers of sdp serialization (webrtc_sdp.h).
|
||||
class SimulcastSdpSerializer {
|
||||
public:
|
||||
// Serialization for the Simulcast description according to
|
||||
// https://tools.ietf.org/html/draft-ietf-mmusic-sdp-simulcast-13#section-5.1
|
||||
|
@ -58,4 +58,4 @@ class SdpSerializer {
|
|||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // PC_SDP_SERIALIZER_H_
|
||||
#endif // PC_SIMULCAST_SDP_SERIALIZER_H_
|
|
@ -8,7 +8,7 @@
|
|||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "pc/sdp_serializer.h"
|
||||
#include "pc/simulcast_sdp_serializer.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
@ -102,7 +102,7 @@ class SimulcastSdpSerializerTest : public TestWithParam<const char*> {
|
|||
// `expected` - The expected output Simulcast to compare to.
|
||||
void TestDeserialization(const std::string& str,
|
||||
const SimulcastDescription& expected) const {
|
||||
SdpSerializer deserializer;
|
||||
SimulcastSdpSerializer deserializer;
|
||||
auto result = deserializer.DeserializeSimulcastDescription(str);
|
||||
EXPECT_TRUE(result.ok());
|
||||
ExpectEqual(expected, result.value());
|
||||
|
@ -113,7 +113,7 @@ class SimulcastSdpSerializerTest : public TestWithParam<const char*> {
|
|||
// `expected` - The expected output string to compare to.
|
||||
void TestSerialization(const SimulcastDescription& simulcast,
|
||||
const std::string& expected) const {
|
||||
SdpSerializer serializer;
|
||||
SimulcastSdpSerializer serializer;
|
||||
auto result = serializer.SerializeSimulcastDescription(simulcast);
|
||||
EXPECT_EQ(expected, result);
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ TEST_F(SimulcastSdpSerializerTest, Deserialize_PausedStreams) {
|
|||
|
||||
// Parameterized negative test case for deserialization with invalid inputs.
|
||||
TEST_P(SimulcastSdpSerializerTest, SimulcastDeserializationFailed) {
|
||||
SdpSerializer deserializer;
|
||||
SimulcastSdpSerializer deserializer;
|
||||
auto result = deserializer.DeserializeSimulcastDescription(GetParam());
|
||||
EXPECT_FALSE(result.ok());
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ class RidDescriptionSdpSerializerTest : public TestWithParam<const char*> {
|
|||
// `expected` - The expected output RidDescription to compare to.
|
||||
void TestDeserialization(const std::string& str,
|
||||
const RidDescription& expected) const {
|
||||
SdpSerializer deserializer;
|
||||
SimulcastSdpSerializer deserializer;
|
||||
auto result = deserializer.DeserializeRidDescription(str);
|
||||
EXPECT_TRUE(result.ok());
|
||||
ExpectEqual(expected, result.value());
|
||||
|
@ -297,7 +297,7 @@ class RidDescriptionSdpSerializerTest : public TestWithParam<const char*> {
|
|||
// `expected` - The expected output string to compare to.
|
||||
void TestSerialization(const RidDescription& rid_description,
|
||||
const std::string& expected) const {
|
||||
SdpSerializer serializer;
|
||||
SimulcastSdpSerializer serializer;
|
||||
auto result = serializer.SerializeRidDescription(rid_description);
|
||||
EXPECT_EQ(expected, result);
|
||||
}
|
||||
|
@ -447,7 +447,7 @@ TEST_F(RidDescriptionSdpSerializerTest, Deserialize_AmbiguousCase) {
|
|||
|
||||
// Parameterized negative test case for deserialization with invalid inputs.
|
||||
TEST_P(RidDescriptionSdpSerializerTest, RidDescriptionDeserializationFailed) {
|
||||
SdpSerializer deserializer;
|
||||
SimulcastSdpSerializer deserializer;
|
||||
auto result = deserializer.DeserializeRidDescription(GetParam());
|
||||
EXPECT_FALSE(result.ok());
|
||||
}
|
|
@ -54,9 +54,9 @@
|
|||
#include "p2p/base/transport_info.h"
|
||||
#include "pc/media_protocol_names.h"
|
||||
#include "pc/media_session.h"
|
||||
#include "pc/sdp_serializer.h"
|
||||
#include "pc/session_description.h"
|
||||
#include "pc/simulcast_description.h"
|
||||
#include "pc/simulcast_sdp_serializer.h"
|
||||
#include "rtc_base/arraysize.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
|
@ -1601,7 +1601,7 @@ void BuildRtpContentAttributes(const MediaContentDescription* media_desc,
|
|||
const cricket::MediaType media_type,
|
||||
int msid_signaling,
|
||||
std::string* message) {
|
||||
SdpSerializer serializer;
|
||||
SimulcastSdpSerializer serializer;
|
||||
rtc::StringBuilder os;
|
||||
// RFC 8285
|
||||
// a=extmap-allow-mixed
|
||||
|
@ -3049,7 +3049,7 @@ bool ParseContent(absl::string_view message,
|
|||
std::string ptime_as_string;
|
||||
std::vector<std::string> stream_ids;
|
||||
std::string track_id;
|
||||
SdpSerializer deserializer;
|
||||
SimulcastSdpSerializer deserializer;
|
||||
std::vector<RidDescription> rids;
|
||||
SimulcastDescription simulcast;
|
||||
|
||||
|
|
Loading…
Reference in a new issue