Clean up some bad constructs in media/
We currently suppress warnings for bad constructs in media/. Still, the
warnings are causing problems when trying to include header files from
this directory. This CL cleans up some of the bad constructs.
Bug: None
Change-Id: I808ad39eb23870d20fa5bb05429b50c9078543ae
Reviewed-on: https://webrtc-review.googlesource.com/4541
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20039}
diff --git a/media/BUILD.gn b/media/BUILD.gn
index 4b956c8..2678a31 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -168,7 +168,9 @@
"engine/webrtcvideocapturer.h",
"engine/webrtcvideocapturerfactory.cc",
"engine/webrtcvideocapturerfactory.h",
+ "engine/webrtcvideodecoderfactory.cc",
"engine/webrtcvideodecoderfactory.h",
+ "engine/webrtcvideoencoderfactory.cc",
"engine/webrtcvideoencoderfactory.h",
"engine/webrtcvideoengine.cc",
"engine/webrtcvideoengine.h",
diff --git a/media/base/codec.cc b/media/base/codec.cc
index b5a68ef..629aba4 100644
--- a/media/base/codec.cc
+++ b/media/base/codec.cc
@@ -32,6 +32,8 @@
profile_level_id->profile == other_profile_level_id->profile;
}
+FeedbackParams::FeedbackParams() = default;
+
bool FeedbackParam::operator==(const FeedbackParam& other) const {
return _stricmp(other.id().c_str(), id().c_str()) == 0 &&
_stricmp(other.param().c_str(), param().c_str()) == 0;
diff --git a/media/base/codec.h b/media/base/codec.h
index ed5c121..bbd7760 100644
--- a/media/base/codec.h
+++ b/media/base/codec.h
@@ -47,6 +47,7 @@
class FeedbackParams {
public:
+ FeedbackParams();
bool operator==(const FeedbackParams& other) const;
bool Has(const FeedbackParam& param) const;
@@ -126,7 +127,7 @@
AudioCodec();
AudioCodec(const AudioCodec& c);
AudioCodec(AudioCodec&& c);
- virtual ~AudioCodec() = default;
+ ~AudioCodec() override = default;
// Indicates if this codec is compatible with the specified codec.
bool Matches(const AudioCodec& codec) const;
@@ -176,7 +177,7 @@
VideoCodec();
VideoCodec(const VideoCodec& c);
VideoCodec(VideoCodec&& c);
- virtual ~VideoCodec() = default;
+ ~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
@@ -222,7 +223,7 @@
DataCodec();
DataCodec(const DataCodec& c);
DataCodec(DataCodec&& c);
- virtual ~DataCodec() = default;
+ ~DataCodec() override = default;
DataCodec& operator=(const DataCodec& c);
DataCodec& operator=(DataCodec&& c);
diff --git a/media/engine/webrtcvideodecoderfactory.cc b/media/engine/webrtcvideodecoderfactory.cc
new file mode 100644
index 0000000..5eee788
--- /dev/null
+++ b/media/engine/webrtcvideodecoderfactory.cc
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+
+#include "media/engine/webrtcvideodecoderfactory.h"
+
+namespace cricket {
+
+webrtc::VideoDecoder* WebRtcVideoDecoderFactory::CreateVideoDecoderWithParams(
+ const VideoCodec& codec,
+ VideoDecoderParams params) {
+ // Default implementation that delegates to old version in order to preserve
+ // backwards-compatability.
+ webrtc::VideoCodecType type = webrtc::PayloadStringToCodecType(codec.name);
+ return CreateVideoDecoderWithParams(type, params);
+}
+
+webrtc::VideoDecoder* WebRtcVideoDecoderFactory::CreateVideoDecoder(
+ webrtc::VideoCodecType type) {
+ RTC_NOTREACHED();
+ return nullptr;
+}
+
+webrtc::VideoDecoder* WebRtcVideoDecoderFactory::CreateVideoDecoderWithParams(
+ webrtc::VideoCodecType type,
+ VideoDecoderParams params) {
+ return CreateVideoDecoder(type);
+}
+
+} // namespace cricket
diff --git a/media/engine/webrtcvideodecoderfactory.h b/media/engine/webrtcvideodecoderfactory.h
index 2c921c5..4032aa2 100644
--- a/media/engine/webrtcvideodecoderfactory.h
+++ b/media/engine/webrtcvideodecoderfactory.h
@@ -33,26 +33,17 @@
// by calling DestroyVideoDecoder().
virtual webrtc::VideoDecoder* CreateVideoDecoderWithParams(
const VideoCodec& codec,
- VideoDecoderParams params) {
- // Default implementation that delegates to old version in order to preserve
- // backwards-compatability.
- webrtc::VideoCodecType type = webrtc::PayloadStringToCodecType(codec.name);
- return CreateVideoDecoderWithParams(type, params);
- }
+ VideoDecoderParams params);
+
// DEPRECATED.
// These methods should not be used by new code and will eventually be
// removed. See http://crbug.com/webrtc/8140.
- virtual webrtc::VideoDecoder* CreateVideoDecoder(
- webrtc::VideoCodecType type) {
- RTC_NOTREACHED();
- return nullptr;
- };
+ virtual webrtc::VideoDecoder* CreateVideoDecoder(webrtc::VideoCodecType type);
virtual webrtc::VideoDecoder* CreateVideoDecoderWithParams(
webrtc::VideoCodecType type,
- VideoDecoderParams params) {
- return CreateVideoDecoder(type);
- }
+ VideoDecoderParams params);
+
virtual ~WebRtcVideoDecoderFactory() {}
virtual void DestroyVideoDecoder(webrtc::VideoDecoder* decoder) = 0;
diff --git a/media/engine/webrtcvideoencoderfactory.cc b/media/engine/webrtcvideoencoderfactory.cc
new file mode 100644
index 0000000..815613e
--- /dev/null
+++ b/media/engine/webrtcvideoencoderfactory.cc
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+
+#include "media/engine/webrtcvideoencoderfactory.h"
+
+namespace cricket {
+
+bool WebRtcVideoEncoderFactory::EncoderTypeHasInternalSource(
+ webrtc::VideoCodecType type) const {
+ return false;
+}
+
+} // namespace cricket
diff --git a/media/engine/webrtcvideoencoderfactory.h b/media/engine/webrtcvideoencoderfactory.h
index 8c629e0..53a529a 100644
--- a/media/engine/webrtcvideoencoderfactory.h
+++ b/media/engine/webrtcvideoencoderfactory.h
@@ -39,9 +39,7 @@
// Returns true if encoders created by this factory of the given codec type
// will use internal camera sources, meaning that they don't require/expect
// frames to be delivered via webrtc::VideoEncoder::Encode.
- virtual bool EncoderTypeHasInternalSource(webrtc::VideoCodecType type) const {
- return false;
- }
+ virtual bool EncoderTypeHasInternalSource(webrtc::VideoCodecType type) const;
virtual void DestroyVideoEncoder(webrtc::VideoEncoder* encoder) = 0;
};