Deprecate functions returning cricket::DataContentDescription.
Due to internal code, deprecating the class itself is difficult. It will be deleted at the same time as the functions. Bug: webrtc:10597 Change-Id: Iac775377c459318e074818abc05f1505c9190bd3 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/138823 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28083}
This commit is contained in:
committed by
Commit Bot
parent
f2e9cab383
commit
a33a86061f
@ -363,7 +363,7 @@ const RtpDataContentDescription* GetFirstRtpDataContentDescription(
|
|||||||
const SctpDataContentDescription* GetFirstSctpDataContentDescription(
|
const SctpDataContentDescription* GetFirstSctpDataContentDescription(
|
||||||
const SessionDescription* sdesc);
|
const SessionDescription* sdesc);
|
||||||
// Returns shim. Deprecated - ask for the right protocol instead.
|
// Returns shim. Deprecated - ask for the right protocol instead.
|
||||||
const DataContentDescription* GetFirstDataContentDescription(
|
RTC_DEPRECATED const DataContentDescription* GetFirstDataContentDescription(
|
||||||
const SessionDescription* sdesc);
|
const SessionDescription* sdesc);
|
||||||
// Non-const versions of the above functions.
|
// Non-const versions of the above functions.
|
||||||
// Useful when modifying an existing description.
|
// Useful when modifying an existing description.
|
||||||
@ -384,7 +384,7 @@ RtpDataContentDescription* GetFirstRtpDataContentDescription(
|
|||||||
SessionDescription* sdesc);
|
SessionDescription* sdesc);
|
||||||
SctpDataContentDescription* GetFirstSctpDataContentDescription(
|
SctpDataContentDescription* GetFirstSctpDataContentDescription(
|
||||||
SessionDescription* sdesc);
|
SessionDescription* sdesc);
|
||||||
DataContentDescription* GetFirstDataContentDescription(
|
RTC_DEPRECATED DataContentDescription* GetFirstDataContentDescription(
|
||||||
SessionDescription* sdesc);
|
SessionDescription* sdesc);
|
||||||
|
|
||||||
// Helper functions to return crypto suites used for SDES.
|
// Helper functions to return crypto suites used for SDES.
|
||||||
|
|||||||
@ -190,13 +190,13 @@ void SessionDescription::AddContent(ContentInfo* content) {
|
|||||||
if (description->as_rtp_data()) {
|
if (description->as_rtp_data()) {
|
||||||
if (description->as_rtp_data() != description) {
|
if (description->as_rtp_data() != description) {
|
||||||
content->set_media_description(
|
content->set_media_description(
|
||||||
description->as_data()->Unshim(&should_delete));
|
description->deprecated_as_data()->Unshim(&should_delete));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (description->as_sctp()) {
|
if (description->as_sctp()) {
|
||||||
if (description->as_sctp() != description) {
|
if (description->as_sctp() != description) {
|
||||||
content->set_media_description(
|
content->set_media_description(
|
||||||
description->as_data()->Unshim(&should_delete));
|
description->deprecated_as_data()->Unshim(&should_delete));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (should_delete) {
|
if (should_delete) {
|
||||||
@ -292,26 +292,34 @@ const ContentGroup* SessionDescription::GetGroupByName(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DataContentDescription shim creation
|
// DataContentDescription shim creation
|
||||||
DataContentDescription* RtpDataContentDescription::as_data() {
|
DataContentDescription* RtpDataContentDescription::deprecated_as_data() {
|
||||||
if (!shim_) {
|
if (!shim_) {
|
||||||
shim_.reset(new DataContentDescription(this));
|
shim_.reset(new DataContentDescription(this));
|
||||||
}
|
}
|
||||||
return shim_.get();
|
return shim_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DataContentDescription* RtpDataContentDescription::as_data() {
|
||||||
|
return deprecated_as_data();
|
||||||
|
}
|
||||||
|
|
||||||
const DataContentDescription* RtpDataContentDescription::as_data() const {
|
const DataContentDescription* RtpDataContentDescription::as_data() const {
|
||||||
return const_cast<RtpDataContentDescription*>(this)->as_data();
|
return const_cast<RtpDataContentDescription*>(this)->as_data();
|
||||||
}
|
}
|
||||||
|
|
||||||
DataContentDescription* SctpDataContentDescription::as_data() {
|
DataContentDescription* SctpDataContentDescription::deprecated_as_data() {
|
||||||
if (!shim_) {
|
if (!shim_) {
|
||||||
shim_.reset(new DataContentDescription(this));
|
shim_.reset(new DataContentDescription(this));
|
||||||
}
|
}
|
||||||
return shim_.get();
|
return shim_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DataContentDescription* SctpDataContentDescription::as_data() {
|
||||||
|
return deprecated_as_data();
|
||||||
|
}
|
||||||
|
|
||||||
const DataContentDescription* SctpDataContentDescription::as_data() const {
|
const DataContentDescription* SctpDataContentDescription::as_data() const {
|
||||||
return const_cast<SctpDataContentDescription*>(this)->as_data();
|
return const_cast<SctpDataContentDescription*>(this)->deprecated_as_data();
|
||||||
}
|
}
|
||||||
|
|
||||||
DataContentDescription::DataContentDescription() {
|
DataContentDescription::DataContentDescription() {
|
||||||
|
|||||||
@ -79,8 +79,11 @@ class MediaContentDescription {
|
|||||||
// Backwards compatible shim: Return a shim object that allows
|
// Backwards compatible shim: Return a shim object that allows
|
||||||
// callers to ignore the distinction between RtpDataContentDescription
|
// callers to ignore the distinction between RtpDataContentDescription
|
||||||
// and SctpDataContentDescription objects.
|
// and SctpDataContentDescription objects.
|
||||||
virtual DataContentDescription* as_data() { return nullptr; }
|
RTC_DEPRECATED virtual DataContentDescription* as_data() { return nullptr; }
|
||||||
virtual const DataContentDescription* as_data() const { return nullptr; }
|
RTC_DEPRECATED virtual const DataContentDescription* as_data() const {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
virtual DataContentDescription* deprecated_as_data() { return nullptr; }
|
||||||
|
|
||||||
virtual RtpDataContentDescription* as_rtp_data() { return nullptr; }
|
virtual RtpDataContentDescription* as_rtp_data() { return nullptr; }
|
||||||
virtual const RtpDataContentDescription* as_rtp_data() const {
|
virtual const RtpDataContentDescription* as_rtp_data() const {
|
||||||
@ -344,8 +347,11 @@ class DataContentDescription : public MediaContentDescriptionImpl<DataCodec> {
|
|||||||
public:
|
public:
|
||||||
DataContentDescription();
|
DataContentDescription();
|
||||||
MediaType type() const override { return MEDIA_TYPE_DATA; }
|
MediaType type() const override { return MEDIA_TYPE_DATA; }
|
||||||
DataContentDescription* as_data() override { return this; }
|
RTC_DEPRECATED DataContentDescription* as_data() override { return this; }
|
||||||
const DataContentDescription* as_data() const override { return this; }
|
RTC_DEPRECATED const DataContentDescription* as_data() const override {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
DataContentDescription* deprecated_as_data() override { return this; }
|
||||||
|
|
||||||
// Override all methods defined in MediaContentDescription.
|
// Override all methods defined in MediaContentDescription.
|
||||||
bool has_codecs() const override;
|
bool has_codecs() const override;
|
||||||
@ -453,8 +459,9 @@ class RtpDataContentDescription
|
|||||||
RtpDataContentDescription* as_rtp_data() override { return this; }
|
RtpDataContentDescription* as_rtp_data() override { return this; }
|
||||||
const RtpDataContentDescription* as_rtp_data() const override { return this; }
|
const RtpDataContentDescription* as_rtp_data() const override { return this; }
|
||||||
// Shim support
|
// Shim support
|
||||||
DataContentDescription* as_data() override;
|
RTC_DEPRECATED DataContentDescription* as_data() override;
|
||||||
const DataContentDescription* as_data() const override;
|
RTC_DEPRECATED const DataContentDescription* as_data() const override;
|
||||||
|
DataContentDescription* deprecated_as_data() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<DataContentDescription> shim_;
|
std::unique_ptr<DataContentDescription> shim_;
|
||||||
@ -476,8 +483,9 @@ class SctpDataContentDescription : public MediaContentDescription {
|
|||||||
SctpDataContentDescription* as_sctp() override { return this; }
|
SctpDataContentDescription* as_sctp() override { return this; }
|
||||||
const SctpDataContentDescription* as_sctp() const override { return this; }
|
const SctpDataContentDescription* as_sctp() const override { return this; }
|
||||||
// Shim support
|
// Shim support
|
||||||
DataContentDescription* as_data() override;
|
RTC_DEPRECATED DataContentDescription* as_data() override;
|
||||||
const DataContentDescription* as_data() const override;
|
RTC_DEPRECATED const DataContentDescription* as_data() const override;
|
||||||
|
DataContentDescription* deprecated_as_data() override;
|
||||||
|
|
||||||
bool has_codecs() const override { return false; }
|
bool has_codecs() const override { return false; }
|
||||||
void set_protocol(const std::string& protocol) override {
|
void set_protocol(const std::string& protocol) override {
|
||||||
|
|||||||
@ -129,6 +129,9 @@ TEST(SessionDescriptionTest, AddContentTransfersExtmapAllowMixedSetting) {
|
|||||||
data_desc->extmap_allow_mixed_enum());
|
data_desc->extmap_allow_mixed_enum());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The tests for DataContentDescription will be deleted soon.
|
||||||
|
// TODO(bugs.webrtc.org/10597): Declare this class obsolete and remove it
|
||||||
|
|
||||||
TEST(SessionDescriptionTest, DataContentDescriptionCanAddStream) {
|
TEST(SessionDescriptionTest, DataContentDescriptionCanAddStream) {
|
||||||
auto description = absl::make_unique<DataContentDescription>();
|
auto description = absl::make_unique<DataContentDescription>();
|
||||||
// Adding a stream without setting protocol first should work.
|
// Adding a stream without setting protocol first should work.
|
||||||
@ -138,7 +141,7 @@ TEST(SessionDescriptionTest, DataContentDescriptionCanAddStream) {
|
|||||||
|
|
||||||
TEST(SessionDescriptionTest, DataContentDescriptionCopyWorks) {
|
TEST(SessionDescriptionTest, DataContentDescriptionCopyWorks) {
|
||||||
auto description = absl::make_unique<RtpDataContentDescription>();
|
auto description = absl::make_unique<RtpDataContentDescription>();
|
||||||
auto shim_description = description->as_data();
|
auto shim_description = description->deprecated_as_data();
|
||||||
auto shim_copy = shim_description->Copy();
|
auto shim_copy = shim_description->Copy();
|
||||||
delete shim_copy;
|
delete shim_copy;
|
||||||
}
|
}
|
||||||
@ -151,7 +154,7 @@ TEST(SessionDescriptionTest, DataContentDescriptionCodecsCallableOnNull) {
|
|||||||
|
|
||||||
TEST(SessionDescriptionTest, DataContentDescriptionSctpConferenceMode) {
|
TEST(SessionDescriptionTest, DataContentDescriptionSctpConferenceMode) {
|
||||||
auto description = absl::make_unique<SctpDataContentDescription>();
|
auto description = absl::make_unique<SctpDataContentDescription>();
|
||||||
auto shim_description = description->as_data();
|
auto shim_description = description->deprecated_as_data();
|
||||||
EXPECT_FALSE(shim_description->conference_mode());
|
EXPECT_FALSE(shim_description->conference_mode());
|
||||||
shim_description->set_conference_mode(true);
|
shim_description->set_conference_mode(true);
|
||||||
EXPECT_TRUE(shim_description->conference_mode());
|
EXPECT_TRUE(shim_description->conference_mode());
|
||||||
|
|||||||
Reference in New Issue
Block a user