Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Unified Diff: webrtc/media/base/codec.cc

Issue 2481193002: Provide move semantic for cricket::Codec and subclasses (Closed)
Patch Set: Remove some faulty test. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/media/base/codec.h ('k') | webrtc/media/engine/webrtcvoiceengine_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/base/codec.cc
diff --git a/webrtc/media/base/codec.cc b/webrtc/media/base/codec.cc
index 0ece9dbe16bd6fd04822f0d9f744c444eed641d5..7375d08b35c9b8e213f190405c4c42cf88590f66 100644
--- a/webrtc/media/base/codec.cc
+++ b/webrtc/media/base/codec.cc
@@ -77,17 +77,10 @@ Codec::Codec(int id, const std::string& name, int clockrate)
Codec::Codec() : id(0), clockrate(0) {}
Codec::Codec(const Codec& c) = default;
-
+Codec::Codec(Codec&& c) = default;
Codec::~Codec() = default;
-
-Codec& Codec::operator=(const Codec& c) {
- this->id = c.id; // id is reserved in objective-c
- name = c.name;
- clockrate = c.clockrate;
- params = c.params;
- feedback_params = c.feedback_params;
- return *this;
-}
+Codec& Codec::operator=(const Codec& c) = default;
+Codec& Codec::operator=(Codec&& c) = default;
bool Codec::operator==(const Codec& c) const {
return this->id == c.id && // id is reserved in objective-c
@@ -99,8 +92,9 @@ bool Codec::Matches(const Codec& codec) const {
// Match the codec id/name based on the typical static/dynamic name rules.
// Matching is case-insensitive.
const int kMaxStaticPayloadId = 95;
- return (codec.id <= kMaxStaticPayloadId) ?
- (id == codec.id) : (_stricmp(name.c_str(), codec.name.c_str()) == 0);
+ return (id <= kMaxStaticPayloadId || codec.id <= kMaxStaticPayloadId)
+ ? (id == codec.id)
+ : (_stricmp(name.c_str(), codec.name.c_str()) == 0);
}
bool Codec::GetParam(const std::string& name, std::string* out) const {
@@ -161,13 +155,9 @@ AudioCodec::AudioCodec() : Codec(), bitrate(0), channels(0) {
}
AudioCodec::AudioCodec(const AudioCodec& c) = default;
-
-AudioCodec& AudioCodec::operator=(const AudioCodec& c) {
- Codec::operator=(c);
- bitrate = c.bitrate;
- channels = c.channels;
- return *this;
-}
+AudioCodec::AudioCodec(AudioCodec&& c) = default;
+AudioCodec& AudioCodec::operator=(const AudioCodec& c) = default;
+AudioCodec& AudioCodec::operator=(AudioCodec&& c) = default;
bool AudioCodec::operator==(const AudioCodec& c) const {
return bitrate == c.bitrate && channels == c.channels && Codec::operator==(c);
@@ -220,11 +210,9 @@ VideoCodec::VideoCodec() : Codec() {
}
VideoCodec::VideoCodec(const VideoCodec& c) = default;
-
-VideoCodec& VideoCodec::operator=(const VideoCodec& c) {
- Codec::operator=(c);
- return *this;
-}
+VideoCodec::VideoCodec(VideoCodec&& c) = default;
+VideoCodec& VideoCodec::operator=(const VideoCodec& c) = default;
+VideoCodec& VideoCodec::operator=(VideoCodec&& c) = default;
bool VideoCodec::operator==(const VideoCodec& c) const {
return Codec::operator==(c);
@@ -282,8 +270,9 @@ DataCodec::DataCodec() : Codec() {
}
DataCodec::DataCodec(const DataCodec& c) = default;
-
+DataCodec::DataCodec(DataCodec&& c) = default;
DataCodec& DataCodec::operator=(const DataCodec& c) = default;
+DataCodec& DataCodec::operator=(DataCodec&& c) = default;
std::string DataCodec::ToString() const {
std::ostringstream os;
« no previous file with comments | « webrtc/media/base/codec.h ('k') | webrtc/media/engine/webrtcvoiceengine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698