Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

249 lines
7.4 KiB
C
Raw Normal View History

/*
* Copyright (c) 2004 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef MEDIA_BASE_CODEC_H_
#define MEDIA_BASE_CODEC_H_
#include <map>
#include <set>
#include <string>
#include <vector>
#include "absl/types/optional.h"
#include "api/rtp_parameters.h"
#include "api/video_codecs/sdp_video_format.h"
#include "media/base/media_constants.h"
#include "rtc_base/system/rtc_export.h"
namespace cricket {
typedef std::map<std::string, std::string> CodecParameterMap;
class FeedbackParam {
public:
FeedbackParam() = default;
FeedbackParam(const std::string& id, const std::string& param)
: id_(id), param_(param) {}
explicit FeedbackParam(const std::string& id)
: id_(id), param_(kParamValueEmpty) {}
bool operator==(const FeedbackParam& other) const;
const std::string& id() const { return id_; }
const std::string& param() const { return param_; }
private:
std::string id_; // e.g. "nack", "ccm"
std::string param_; // e.g. "", "rpsi", "fir"
};
class FeedbackParams {
public:
FeedbackParams();
~FeedbackParams();
bool operator==(const FeedbackParams& other) const;
bool Has(const FeedbackParam& param) const;
void Add(const FeedbackParam& param);
void Intersect(const FeedbackParams& from);
const std::vector<FeedbackParam>& params() const { return params_; }
private:
bool HasDuplicateEntries() const;
std::vector<FeedbackParam> params_;
};
struct RTC_EXPORT Codec {
int id;
std::string name;
int clockrate;
CodecParameterMap params;
FeedbackParams feedback_params;
virtual ~Codec();
// Indicates if this codec is compatible with the specified codec.
bool Matches(const Codec& codec) const;
bool MatchesCapability(const webrtc::RtpCodecCapability& capability) const;
// Find the parameter for |name| and write the value to |out|.
bool GetParam(const std::string& name, std::string* out) const;
bool GetParam(const std::string& name, int* out) const;
void SetParam(const std::string& name, const std::string& value);
void SetParam(const std::string& name, int value);
// It is safe to input a non-existent parameter.
// Returns true if the parameter existed, false if it did not exist.
bool RemoveParam(const std::string& name);
bool HasFeedbackParam(const FeedbackParam& param) const;
void AddFeedbackParam(const FeedbackParam& param);
// Filter |this| feedbacks params such that only those shared by both |this|
// and |other| are kept.
void IntersectFeedbackParams(const Codec& other);
virtual webrtc::RtpCodecParameters ToCodecParameters() const;
Make webrtc 50 KB smaller by not inlining Codec. The Codec class is a big class and objects of the Codec class are passed around by value. That means that inlined operations would be duplicated at many places, in particular inside STL. By not inlining Codec methods, webrtc shrinks by 50 KB in a Linux x64 clang build. Total change: -54147 bytes ========================== +2810 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/codec.cc - (gained 2920, lost 110) -1003 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/codec.h - (gained 0, lost 1003) -1129 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/sctp/sctpdataengine.cc - (gained 1660, lost 2789) -1190 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/rtpdataengine.cc - (gained 1408, lost 2598) -1747 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/session/media/mediasession.cc - (gained 803, lost 2550) -2141 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/webrtc/webrtcvideoengine.cc - (gained 1679, lost 3820) -2250 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/app/webrtc/webrtcsdp.cc - (gained 1224, lost 3474) -2927 - Source: /usr/include/c++/4.8/bits/stl_vector.h - (gained 0, lost 2927) -3729 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/webrtc/webrtcvideoengine2.cc - (gained 10925, lost 14654) -6369 - Source: /usr/include/c++/4.8/bits/vector.tcc - (gained 0, lost 6369) -10582 - Source: /usr/include/c++/4.8/bits/stl_heap.h - (gained 0, lost 10582) -19324 - Source: /usr/include/c++/4.8/bits/stl_algo.h - (gained 743, lost 20067) BUG= R=juberti@webrtc.org Review URL: https://webrtc-codereview.appspot.com/40729005 Cr-Commit-Position: refs/heads/master@{#8436} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8436 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-02-19 17:55:18 +00:00
Codec& operator=(const Codec& c);
Codec& operator=(Codec&& c);
Make webrtc 50 KB smaller by not inlining Codec. The Codec class is a big class and objects of the Codec class are passed around by value. That means that inlined operations would be duplicated at many places, in particular inside STL. By not inlining Codec methods, webrtc shrinks by 50 KB in a Linux x64 clang build. Total change: -54147 bytes ========================== +2810 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/codec.cc - (gained 2920, lost 110) -1003 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/codec.h - (gained 0, lost 1003) -1129 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/sctp/sctpdataengine.cc - (gained 1660, lost 2789) -1190 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/rtpdataengine.cc - (gained 1408, lost 2598) -1747 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/session/media/mediasession.cc - (gained 803, lost 2550) -2141 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/webrtc/webrtcvideoengine.cc - (gained 1679, lost 3820) -2250 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/app/webrtc/webrtcsdp.cc - (gained 1224, lost 3474) -2927 - Source: /usr/include/c++/4.8/bits/stl_vector.h - (gained 0, lost 2927) -3729 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/webrtc/webrtcvideoengine2.cc - (gained 10925, lost 14654) -6369 - Source: /usr/include/c++/4.8/bits/vector.tcc - (gained 0, lost 6369) -10582 - Source: /usr/include/c++/4.8/bits/stl_heap.h - (gained 0, lost 10582) -19324 - Source: /usr/include/c++/4.8/bits/stl_algo.h - (gained 743, lost 20067) BUG= R=juberti@webrtc.org Review URL: https://webrtc-codereview.appspot.com/40729005 Cr-Commit-Position: refs/heads/master@{#8436} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8436 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-02-19 17:55:18 +00:00
bool operator==(const Codec& c) const;
bool operator!=(const Codec& c) const { return !(*this == c); }
protected:
// A Codec can't be created without a subclass.
// Creates a codec with the given parameters.
Codec(int id, const std::string& name, int clockrate);
// Creates an empty codec.
Codec();
Codec(const Codec& c);
Codec(Codec&& c);
};
struct AudioCodec : public Codec {
int bitrate;
size_t channels;
// Creates a codec with the given parameters.
AudioCodec(int id,
const std::string& name,
int clockrate,
int bitrate,
size_t channels);
// Creates an empty codec.
Make webrtc 50 KB smaller by not inlining Codec. The Codec class is a big class and objects of the Codec class are passed around by value. That means that inlined operations would be duplicated at many places, in particular inside STL. By not inlining Codec methods, webrtc shrinks by 50 KB in a Linux x64 clang build. Total change: -54147 bytes ========================== +2810 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/codec.cc - (gained 2920, lost 110) -1003 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/codec.h - (gained 0, lost 1003) -1129 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/sctp/sctpdataengine.cc - (gained 1660, lost 2789) -1190 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/rtpdataengine.cc - (gained 1408, lost 2598) -1747 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/session/media/mediasession.cc - (gained 803, lost 2550) -2141 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/webrtc/webrtcvideoengine.cc - (gained 1679, lost 3820) -2250 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/app/webrtc/webrtcsdp.cc - (gained 1224, lost 3474) -2927 - Source: /usr/include/c++/4.8/bits/stl_vector.h - (gained 0, lost 2927) -3729 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/webrtc/webrtcvideoengine2.cc - (gained 10925, lost 14654) -6369 - Source: /usr/include/c++/4.8/bits/vector.tcc - (gained 0, lost 6369) -10582 - Source: /usr/include/c++/4.8/bits/stl_heap.h - (gained 0, lost 10582) -19324 - Source: /usr/include/c++/4.8/bits/stl_algo.h - (gained 743, lost 20067) BUG= R=juberti@webrtc.org Review URL: https://webrtc-codereview.appspot.com/40729005 Cr-Commit-Position: refs/heads/master@{#8436} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8436 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-02-19 17:55:18 +00:00
AudioCodec();
AudioCodec(const AudioCodec& c);
AudioCodec(AudioCodec&& c);
~AudioCodec() override = default;
// Indicates if this codec is compatible with the specified codec.
bool Matches(const AudioCodec& codec) const;
std::string ToString() const;
webrtc::RtpCodecParameters ToCodecParameters() const override;
Make webrtc 50 KB smaller by not inlining Codec. The Codec class is a big class and objects of the Codec class are passed around by value. That means that inlined operations would be duplicated at many places, in particular inside STL. By not inlining Codec methods, webrtc shrinks by 50 KB in a Linux x64 clang build. Total change: -54147 bytes ========================== +2810 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/codec.cc - (gained 2920, lost 110) -1003 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/codec.h - (gained 0, lost 1003) -1129 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/sctp/sctpdataengine.cc - (gained 1660, lost 2789) -1190 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/rtpdataengine.cc - (gained 1408, lost 2598) -1747 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/session/media/mediasession.cc - (gained 803, lost 2550) -2141 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/webrtc/webrtcvideoengine.cc - (gained 1679, lost 3820) -2250 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/app/webrtc/webrtcsdp.cc - (gained 1224, lost 3474) -2927 - Source: /usr/include/c++/4.8/bits/stl_vector.h - (gained 0, lost 2927) -3729 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/webrtc/webrtcvideoengine2.cc - (gained 10925, lost 14654) -6369 - Source: /usr/include/c++/4.8/bits/vector.tcc - (gained 0, lost 6369) -10582 - Source: /usr/include/c++/4.8/bits/stl_heap.h - (gained 0, lost 10582) -19324 - Source: /usr/include/c++/4.8/bits/stl_algo.h - (gained 743, lost 20067) BUG= R=juberti@webrtc.org Review URL: https://webrtc-codereview.appspot.com/40729005 Cr-Commit-Position: refs/heads/master@{#8436} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8436 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-02-19 17:55:18 +00:00
AudioCodec& operator=(const AudioCodec& c);
AudioCodec& operator=(AudioCodec&& c);
Make webrtc 50 KB smaller by not inlining Codec. The Codec class is a big class and objects of the Codec class are passed around by value. That means that inlined operations would be duplicated at many places, in particular inside STL. By not inlining Codec methods, webrtc shrinks by 50 KB in a Linux x64 clang build. Total change: -54147 bytes ========================== +2810 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/codec.cc - (gained 2920, lost 110) -1003 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/codec.h - (gained 0, lost 1003) -1129 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/sctp/sctpdataengine.cc - (gained 1660, lost 2789) -1190 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/rtpdataengine.cc - (gained 1408, lost 2598) -1747 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/session/media/mediasession.cc - (gained 803, lost 2550) -2141 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/webrtc/webrtcvideoengine.cc - (gained 1679, lost 3820) -2250 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/app/webrtc/webrtcsdp.cc - (gained 1224, lost 3474) -2927 - Source: /usr/include/c++/4.8/bits/stl_vector.h - (gained 0, lost 2927) -3729 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/webrtc/webrtcvideoengine2.cc - (gained 10925, lost 14654) -6369 - Source: /usr/include/c++/4.8/bits/vector.tcc - (gained 0, lost 6369) -10582 - Source: /usr/include/c++/4.8/bits/stl_heap.h - (gained 0, lost 10582) -19324 - Source: /usr/include/c++/4.8/bits/stl_algo.h - (gained 743, lost 20067) BUG= R=juberti@webrtc.org Review URL: https://webrtc-codereview.appspot.com/40729005 Cr-Commit-Position: refs/heads/master@{#8436} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8436 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-02-19 17:55:18 +00:00
bool operator==(const AudioCodec& c) const;
bool operator!=(const AudioCodec& c) const { return !(*this == c); }
};
struct RTC_EXPORT VideoCodec : public Codec {
absl::optional<std::string> packetization;
// Creates a codec with the given parameters.
VideoCodec(int id, const std::string& name);
// Creates a codec with the given name and empty id.
explicit VideoCodec(const std::string& name);
// Creates an empty codec.
Make webrtc 50 KB smaller by not inlining Codec. The Codec class is a big class and objects of the Codec class are passed around by value. That means that inlined operations would be duplicated at many places, in particular inside STL. By not inlining Codec methods, webrtc shrinks by 50 KB in a Linux x64 clang build. Total change: -54147 bytes ========================== +2810 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/codec.cc - (gained 2920, lost 110) -1003 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/codec.h - (gained 0, lost 1003) -1129 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/sctp/sctpdataengine.cc - (gained 1660, lost 2789) -1190 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/rtpdataengine.cc - (gained 1408, lost 2598) -1747 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/session/media/mediasession.cc - (gained 803, lost 2550) -2141 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/webrtc/webrtcvideoengine.cc - (gained 1679, lost 3820) -2250 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/app/webrtc/webrtcsdp.cc - (gained 1224, lost 3474) -2927 - Source: /usr/include/c++/4.8/bits/stl_vector.h - (gained 0, lost 2927) -3729 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/webrtc/webrtcvideoengine2.cc - (gained 10925, lost 14654) -6369 - Source: /usr/include/c++/4.8/bits/vector.tcc - (gained 0, lost 6369) -10582 - Source: /usr/include/c++/4.8/bits/stl_heap.h - (gained 0, lost 10582) -19324 - Source: /usr/include/c++/4.8/bits/stl_algo.h - (gained 743, lost 20067) BUG= R=juberti@webrtc.org Review URL: https://webrtc-codereview.appspot.com/40729005 Cr-Commit-Position: refs/heads/master@{#8436} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8436 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-02-19 17:55:18 +00:00
VideoCodec();
VideoCodec(const VideoCodec& c);
explicit VideoCodec(const webrtc::SdpVideoFormat& c);
VideoCodec(VideoCodec&& c);
~VideoCodec() override = default;
// Indicates if this video codec is the same as the other video codec, e.g. if
// they are both VP8 or VP9, or if they are both H264 with the same H264
// profile. H264 levels however are not compared.
bool Matches(const VideoCodec& codec) const;
std::string ToString() const;
webrtc::RtpCodecParameters ToCodecParameters() const override;
Make webrtc 50 KB smaller by not inlining Codec. The Codec class is a big class and objects of the Codec class are passed around by value. That means that inlined operations would be duplicated at many places, in particular inside STL. By not inlining Codec methods, webrtc shrinks by 50 KB in a Linux x64 clang build. Total change: -54147 bytes ========================== +2810 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/codec.cc - (gained 2920, lost 110) -1003 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/codec.h - (gained 0, lost 1003) -1129 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/sctp/sctpdataengine.cc - (gained 1660, lost 2789) -1190 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/rtpdataengine.cc - (gained 1408, lost 2598) -1747 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/session/media/mediasession.cc - (gained 803, lost 2550) -2141 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/webrtc/webrtcvideoengine.cc - (gained 1679, lost 3820) -2250 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/app/webrtc/webrtcsdp.cc - (gained 1224, lost 3474) -2927 - Source: /usr/include/c++/4.8/bits/stl_vector.h - (gained 0, lost 2927) -3729 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/webrtc/webrtcvideoengine2.cc - (gained 10925, lost 14654) -6369 - Source: /usr/include/c++/4.8/bits/vector.tcc - (gained 0, lost 6369) -10582 - Source: /usr/include/c++/4.8/bits/stl_heap.h - (gained 0, lost 10582) -19324 - Source: /usr/include/c++/4.8/bits/stl_algo.h - (gained 743, lost 20067) BUG= R=juberti@webrtc.org Review URL: https://webrtc-codereview.appspot.com/40729005 Cr-Commit-Position: refs/heads/master@{#8436} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8436 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-02-19 17:55:18 +00:00
VideoCodec& operator=(const VideoCodec& c);
VideoCodec& operator=(VideoCodec&& c);
Make webrtc 50 KB smaller by not inlining Codec. The Codec class is a big class and objects of the Codec class are passed around by value. That means that inlined operations would be duplicated at many places, in particular inside STL. By not inlining Codec methods, webrtc shrinks by 50 KB in a Linux x64 clang build. Total change: -54147 bytes ========================== +2810 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/codec.cc - (gained 2920, lost 110) -1003 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/codec.h - (gained 0, lost 1003) -1129 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/sctp/sctpdataengine.cc - (gained 1660, lost 2789) -1190 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/base/rtpdataengine.cc - (gained 1408, lost 2598) -1747 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/session/media/mediasession.cc - (gained 803, lost 2550) -2141 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/webrtc/webrtcvideoengine.cc - (gained 1679, lost 3820) -2250 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/app/webrtc/webrtcsdp.cc - (gained 1224, lost 3474) -2927 - Source: /usr/include/c++/4.8/bits/stl_vector.h - (gained 0, lost 2927) -3729 - Source: /home/bratell/src/chromium/src/third_party/libjingle/source/talk/media/webrtc/webrtcvideoengine2.cc - (gained 10925, lost 14654) -6369 - Source: /usr/include/c++/4.8/bits/vector.tcc - (gained 0, lost 6369) -10582 - Source: /usr/include/c++/4.8/bits/stl_heap.h - (gained 0, lost 10582) -19324 - Source: /usr/include/c++/4.8/bits/stl_algo.h - (gained 743, lost 20067) BUG= R=juberti@webrtc.org Review URL: https://webrtc-codereview.appspot.com/40729005 Cr-Commit-Position: refs/heads/master@{#8436} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8436 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-02-19 17:55:18 +00:00
bool operator==(const VideoCodec& c) const;
bool operator!=(const VideoCodec& c) const { return !(*this == c); }
// Return packetization which both |local_codec| and |remote_codec| support.
static absl::optional<std::string> IntersectPacketization(
const VideoCodec& local_codec,
const VideoCodec& remote_codec);
static VideoCodec CreateRtxCodec(int rtx_payload_type,
int associated_payload_type);
enum CodecType {
CODEC_VIDEO,
CODEC_RED,
CODEC_ULPFEC,
CODEC_FLEXFEC,
CODEC_RTX,
};
CodecType GetCodecType() const;
// Validates a VideoCodec's payload type, dimensions and bitrates etc. If they
// don't make sense (such as max < min bitrate), and error is logged and
// ValidateCodecFormat returns false.
bool ValidateCodecFormat() const;
private:
void SetDefaultParameters();
};
Reland "Reland "Version 2 "Refactoring DataContentDescription class""" This reverts commit 46afbf9481fbcc939c998c898ca1031ce41cc6b1. Reason for revert: Tightened protocol name handling. Original change's description: > Revert "Reland "Version 2 "Refactoring DataContentDescription class""" > > This reverts commit 37f2b43274a0d718de53a4cfcf02226356edcf6e. > > Reason for revert: fuzzer failures > > Original change's description: > > Reland "Version 2 "Refactoring DataContentDescription class"" > > > > This is a reland of 14b2758726879d21671a21291dfed8fb4fd5c21c > > > > Original change's description: > > > Version 2 "Refactoring DataContentDescription class" > > > > > > (substantial changes since version 1) > > > > > > This CL splits the cricket::DataContentDescription class into > > > two classes: cricket::RtpDataContentDescription (used for RTP data) > > > and cricket::SctpDataContentDescription (used for SCTP only). > > > > > > SctpDataContentDescription no longer inherits from > > > MediaContentDescriptionImpl, and no longer contains "codecs". > > > > > > Due to usage of internal interfaces by consumers, shimming the old > > > DataContentDescription API is needed. > > > > > > A new cricket::DataContentDescription class is defined, which is > > > a shim over RtpDataContentDescription and SctpDataContentDescription. > > > It exposes as little functionality as possible, but supports the > > > concerned consumer's usage > > > > > > Design document: > > > https://docs.google.com/document/d/1H5LfQxJA2ikMWTQ8FZ3_GAmaXM7knfVQWiSz6ph8VQ0/edit# > > > > > > Version 1 reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132700 > > > Bug: webrtc:10358 Change-Id: Ia9fb8f4679e082e3d18fbbb6b03fc13a08e06110 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/136581 Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27933}
2019-05-13 13:36:16 +02:00
struct RtpDataCodec : public Codec {
RtpDataCodec(int id, const std::string& name);
RtpDataCodec();
RtpDataCodec(const RtpDataCodec& c);
RtpDataCodec(RtpDataCodec&& c);
~RtpDataCodec() override = default;
Reland "Reland "Version 2 "Refactoring DataContentDescription class""" This reverts commit 46afbf9481fbcc939c998c898ca1031ce41cc6b1. Reason for revert: Tightened protocol name handling. Original change's description: > Revert "Reland "Version 2 "Refactoring DataContentDescription class""" > > This reverts commit 37f2b43274a0d718de53a4cfcf02226356edcf6e. > > Reason for revert: fuzzer failures > > Original change's description: > > Reland "Version 2 "Refactoring DataContentDescription class"" > > > > This is a reland of 14b2758726879d21671a21291dfed8fb4fd5c21c > > > > Original change's description: > > > Version 2 "Refactoring DataContentDescription class" > > > > > > (substantial changes since version 1) > > > > > > This CL splits the cricket::DataContentDescription class into > > > two classes: cricket::RtpDataContentDescription (used for RTP data) > > > and cricket::SctpDataContentDescription (used for SCTP only). > > > > > > SctpDataContentDescription no longer inherits from > > > MediaContentDescriptionImpl, and no longer contains "codecs". > > > > > > Due to usage of internal interfaces by consumers, shimming the old > > > DataContentDescription API is needed. > > > > > > A new cricket::DataContentDescription class is defined, which is > > > a shim over RtpDataContentDescription and SctpDataContentDescription. > > > It exposes as little functionality as possible, but supports the > > > concerned consumer's usage > > > > > > Design document: > > > https://docs.google.com/document/d/1H5LfQxJA2ikMWTQ8FZ3_GAmaXM7knfVQWiSz6ph8VQ0/edit# > > > > > > Version 1 reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132700 > > > Bug: webrtc:10358 Change-Id: Ia9fb8f4679e082e3d18fbbb6b03fc13a08e06110 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/136581 Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27933}
2019-05-13 13:36:16 +02:00
RtpDataCodec& operator=(const RtpDataCodec& c);
RtpDataCodec& operator=(RtpDataCodec&& c);
std::string ToString() const;
};
Reland "Reland "Version 2 "Refactoring DataContentDescription class""" This reverts commit 46afbf9481fbcc939c998c898ca1031ce41cc6b1. Reason for revert: Tightened protocol name handling. Original change's description: > Revert "Reland "Version 2 "Refactoring DataContentDescription class""" > > This reverts commit 37f2b43274a0d718de53a4cfcf02226356edcf6e. > > Reason for revert: fuzzer failures > > Original change's description: > > Reland "Version 2 "Refactoring DataContentDescription class"" > > > > This is a reland of 14b2758726879d21671a21291dfed8fb4fd5c21c > > > > Original change's description: > > > Version 2 "Refactoring DataContentDescription class" > > > > > > (substantial changes since version 1) > > > > > > This CL splits the cricket::DataContentDescription class into > > > two classes: cricket::RtpDataContentDescription (used for RTP data) > > > and cricket::SctpDataContentDescription (used for SCTP only). > > > > > > SctpDataContentDescription no longer inherits from > > > MediaContentDescriptionImpl, and no longer contains "codecs". > > > > > > Due to usage of internal interfaces by consumers, shimming the old > > > DataContentDescription API is needed. > > > > > > A new cricket::DataContentDescription class is defined, which is > > > a shim over RtpDataContentDescription and SctpDataContentDescription. > > > It exposes as little functionality as possible, but supports the > > > concerned consumer's usage > > > > > > Design document: > > > https://docs.google.com/document/d/1H5LfQxJA2ikMWTQ8FZ3_GAmaXM7knfVQWiSz6ph8VQ0/edit# > > > > > > Version 1 reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132700 > > > Bug: webrtc:10358 Change-Id: Ia9fb8f4679e082e3d18fbbb6b03fc13a08e06110 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/136581 Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27933}
2019-05-13 13:36:16 +02:00
// For backwards compatibility
// TODO(bugs.webrtc.org/10597): Remove when no longer needed.
typedef RtpDataCodec DataCodec;
// Get the codec setting associated with |payload_type|. If there
// is no codec associated with that payload type it returns nullptr.
template <class Codec>
const Codec* FindCodecById(const std::vector<Codec>& codecs, int payload_type) {
for (const auto& codec : codecs) {
if (codec.id == payload_type)
return &codec;
}
return nullptr;
}
bool HasLntf(const Codec& codec);
bool HasNack(const Codec& codec);
bool HasRemb(const Codec& codec);
bool HasRrtr(const Codec& codec);
bool HasTransportCc(const Codec& codec);
// Returns the first codec in |supported_codecs| that matches |codec|, or
// nullptr if no codec matches.
const VideoCodec* FindMatchingCodec(
const std::vector<VideoCodec>& supported_codecs,
const VideoCodec& codec);
RTC_EXPORT bool IsSameCodec(const std::string& name1,
const CodecParameterMap& params1,
const std::string& name2,
const CodecParameterMap& params2);
} // namespace cricket
#endif // MEDIA_BASE_CODEC_H_