Revert "Reland "Refactoring DataContentDescription class""

This reverts commit 26bf7c4682c7ec72465a1d4d6485d2ec01f671cc.

Reason for revert: breaks downstream test

Original change's description:
> Reland "Refactoring DataContentDescription class"
> 
> This reverts commit 1859dc04fd8bd35a3d2ee1140bde3eac210bb0c2.
> 
> Reason for revert: Issue likely unrelated to this CL.
> 
> Original change's description:
> > Revert "Refactoring DataContentDescription class"
> >
> > This reverts commit 8a9193c217d818fea77b9540bd4ca7ebad53db76.
> >
> > Reason for revert: Breaks downstreams
> >
> > Original change's description:
> > > Refactoring DataContentDescription class
> > >
> > > This CL splits the cricket::DataContentDescription class into
> > > two classes: cricket::DataContentDescription (used for RTP data) and
> > > cricket::SctpDataContentDescription (used for SCTP only).
> > >
> > > SctpDataContentDescription no longer inherits from
> > > MediaContentDescriptionImpl, and no longer contains "codecs".
> > >
> > > Design document:
> > > https://docs.google.com/document/d/1H5LfQxJA2ikMWTQ8FZ3_GAmaXM7knfVQWiSz6ph8VQ0/edit#
> > >
> > > Bug: webrtc:10358
> > > Change-Id: Ie7160610506aeef56d1f821b5fdb5d9492201f43
> > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132700
> > > Reviewed-by: Steve Anton <steveanton@webrtc.org>
> > > Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> > > Cr-Commit-Position: refs/heads/master@{#27651}
> >
> > TBR=steveanton@webrtc.org,kwiberg@webrtc.org,hbos@webrtc.org,hta@webrtc.org
> >
> > Change-Id: I3b8a68cd481c41ce30eeb5ffbc5da735a9659019
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: webrtc:10358
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/133360
> > Reviewed-by: Seth Hampson <shampson@webrtc.org>
> > Commit-Queue: Seth Hampson <shampson@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#27652}
> 
> # Not skipping CQ checks because original CL landed > 1 day ago.
> 
> Bug: webrtc:10358
> Change-Id: Ie58f862f8c55d2a994eaee1caa107ef701b0770f
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/133624
> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#27698}

TBR=danilchap@webrtc.org,steveanton@webrtc.org,kwiberg@webrtc.org,hbos@webrtc.org,hta@webrtc.org,shampson@webrtc.org

Change-Id: Ib17939d5f1e8c57652dcb34d94866654192379bb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:10358
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/133880
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27702}
This commit is contained in:
Danil Chapovalov
2019-04-23 09:48:11 +00:00
committed by Commit Bot
parent 77c0a62760
commit c6d1d24de8
12 changed files with 309 additions and 498 deletions

View File

@ -26,7 +26,6 @@
#include "media/base/stream_params.h"
#include "p2p/base/transport_description.h"
#include "p2p/base/transport_info.h"
#include "pc/media_protocol_names.h"
#include "pc/simulcast_description.h"
#include "rtc_base/socket_address.h"
@ -45,6 +44,12 @@ extern const char kMediaProtocolSavpf[];
extern const char kMediaProtocolDtlsSavpf[];
extern const char kMediaProtocolRtpPrefix[];
extern const char kMediaProtocolSctp[];
extern const char kMediaProtocolDtlsSctp[];
extern const char kMediaProtocolUdpDtlsSctp[];
extern const char kMediaProtocolTcpDtlsSctp[];
// Options to control how session descriptions are generated.
const int kAutoBandwidth = -1;
@ -52,7 +57,6 @@ const int kAutoBandwidth = -1;
class AudioContentDescription;
class DataContentDescription;
class VideoContentDescription;
class SctpDataContentDescription;
// Describes a session description media section. There are subclasses for each
// media type (audio, video, data) that will have additional information.
@ -78,9 +82,6 @@ class MediaContentDescription {
virtual DataContentDescription* as_data() { return nullptr; }
virtual const DataContentDescription* as_data() const { return nullptr; }
virtual SctpDataContentDescription* as_sctp() { return nullptr; }
virtual const SctpDataContentDescription* as_sctp() const { return nullptr; }
virtual bool has_codecs() const = 0;
virtual MediaContentDescription* Copy() const = 0;
@ -88,9 +89,7 @@ class MediaContentDescription {
// |protocol| is the expected media transport protocol, such as RTP/AVPF,
// RTP/SAVPF or SCTP/DTLS.
std::string protocol() const { return protocol_; }
virtual void set_protocol(const std::string& protocol) {
protocol_ = protocol;
}
void set_protocol(const std::string& protocol) { protocol_ = protocol; }
webrtc::RtpTransceiverDirection direction() const { return direction_; }
void set_direction(webrtc::RtpTransceiverDirection direction) {
@ -248,17 +247,12 @@ using ContentDescription = MediaContentDescription;
template <class C>
class MediaContentDescriptionImpl : public MediaContentDescription {
public:
void set_protocol(const std::string& protocol) override {
RTC_DCHECK(IsRtpProtocol(protocol));
protocol_ = protocol;
}
typedef C CodecType;
// Codecs should be in preference order (most preferred codec first).
const std::vector<C>& codecs() const { return codecs_; }
void set_codecs(const std::vector<C>& codecs) { codecs_ = codecs; }
bool has_codecs() const override { return !codecs_.empty(); }
virtual bool has_codecs() const { return !codecs_.empty(); }
bool HasCodec(int id) {
bool found = false;
for (typename std::vector<C>::iterator iter = codecs_.begin();
@ -324,37 +318,12 @@ class DataContentDescription : public MediaContentDescriptionImpl<DataCodec> {
virtual MediaType type() const { return MEDIA_TYPE_DATA; }
virtual DataContentDescription* as_data() { return this; }
virtual const DataContentDescription* as_data() const { return this; }
};
class SctpDataContentDescription : public MediaContentDescription {
public:
SctpDataContentDescription() {}
SctpDataContentDescription* Copy() const override {
return new SctpDataContentDescription(*this);
}
MediaType type() const override { return MEDIA_TYPE_DATA; }
SctpDataContentDescription* as_sctp() override { return this; }
const SctpDataContentDescription* as_sctp() const override { return this; }
bool has_codecs() const override { return false; }
void set_protocol(const std::string& protocol) override {
RTC_DCHECK(IsSctpProtocol(protocol));
protocol_ = protocol;
}
bool use_sctpmap() const { return use_sctpmap_; }
void set_use_sctpmap(bool enable) { use_sctpmap_ = enable; }
int port() const { return port_; }
void set_port(int port) { port_ = port; }
int max_message_size() const { return max_message_size_; }
void set_max_message_size(int max_message_size) {
max_message_size_ = max_message_size;
}
private:
bool use_sctpmap_ = true; // Note: "true" is no longer conformant.
// Defaults should be constants imported from SCTP. Quick hack.
int port_ = 5000;
int max_message_size_ = 256 * 1024;
bool use_sctpmap_ = true;
};
// Protocol used for encoding media. This is the "top level" protocol that may