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}
This commit is contained in:
Magnus Jedvert 2017-09-28 21:19:18 +02:00 committed by Commit Bot
parent cbc4b1dc41
commit 244ad80444
7 changed files with 70 additions and 20 deletions

View File

@ -168,7 +168,9 @@ rtc_static_library("rtc_audio_video") {
"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",

View File

@ -32,6 +32,8 @@ static bool IsSameH264Profile(const CodecParameterMap& params1,
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;

View File

@ -47,6 +47,7 @@ class FeedbackParam {
class FeedbackParams {
public:
FeedbackParams();
bool operator==(const FeedbackParams& other) const;
bool Has(const FeedbackParam& param) const;
@ -126,7 +127,7 @@ struct AudioCodec : public Codec {
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 @@ struct VideoCodec : public Codec {
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 @@ struct DataCodec : public Codec {
DataCodec();
DataCodec(const DataCodec& c);
DataCodec(DataCodec&& c);
virtual ~DataCodec() = default;
~DataCodec() override = default;
DataCodec& operator=(const DataCodec& c);
DataCodec& operator=(DataCodec&& c);

View File

@ -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

View File

@ -33,26 +33,17 @@ class WebRtcVideoDecoderFactory {
// 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;

View File

@ -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

View File

@ -39,9 +39,7 @@ class WebRtcVideoEncoderFactory {
// 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;
};