Update internal SW codecs to return unique_ptrs
TBR=stefan@webrtc.org Bug: webrtc:7925 Change-Id: I84239b071a2608d928f09b06809090eec5eafb14 Reviewed-on: https://webrtc-review.googlesource.com/21165 Commit-Queue: Magnus Jedvert <magjed@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20650}
This commit is contained in:
committed by
Commit Bot
parent
8f91f1ee71
commit
4fe6adc06a
@ -21,6 +21,7 @@
|
||||
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/ptr_util.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -70,12 +71,13 @@ std::vector<SdpVideoFormat> SupportedH264Codecs() {
|
||||
CreateH264Format(H264::kProfileConstrainedBaseline, H264::kLevel3_1)};
|
||||
}
|
||||
|
||||
H264Encoder* H264Encoder::Create(const cricket::VideoCodec& codec) {
|
||||
std::unique_ptr<H264Encoder> H264Encoder::Create(
|
||||
const cricket::VideoCodec& codec) {
|
||||
RTC_DCHECK(H264Encoder::IsSupported());
|
||||
#if defined(WEBRTC_USE_H264)
|
||||
RTC_CHECK(g_rtc_use_h264);
|
||||
RTC_LOG(LS_INFO) << "Creating H264EncoderImpl.";
|
||||
return new H264EncoderImpl(codec);
|
||||
return rtc::MakeUnique<H264EncoderImpl>(codec);
|
||||
#else
|
||||
RTC_NOTREACHED();
|
||||
return nullptr;
|
||||
@ -86,12 +88,12 @@ bool H264Encoder::IsSupported() {
|
||||
return IsH264CodecSupported();
|
||||
}
|
||||
|
||||
H264Decoder* H264Decoder::Create() {
|
||||
std::unique_ptr<H264Decoder> H264Decoder::Create() {
|
||||
RTC_DCHECK(H264Decoder::IsSupported());
|
||||
#if defined(WEBRTC_USE_H264)
|
||||
RTC_CHECK(g_rtc_use_h264);
|
||||
RTC_LOG(LS_INFO) << "Creating H264DecoderImpl.";
|
||||
return new H264DecoderImpl();
|
||||
return rtc::MakeUnique<H264DecoderImpl>();
|
||||
#else
|
||||
RTC_NOTREACHED();
|
||||
return nullptr;
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
#ifndef MODULES_VIDEO_CODING_CODECS_H264_INCLUDE_H264_H_
|
||||
#define MODULES_VIDEO_CODING_CODECS_H264_INCLUDE_H264_H_
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "media/base/codec.h"
|
||||
@ -33,7 +34,7 @@ std::vector<SdpVideoFormat> SupportedH264Codecs();
|
||||
|
||||
class H264Encoder : public VideoEncoder {
|
||||
public:
|
||||
static H264Encoder* Create(const cricket::VideoCodec& codec);
|
||||
static std::unique_ptr<H264Encoder> Create(const cricket::VideoCodec& codec);
|
||||
// If H.264 is supported (any implementation).
|
||||
static bool IsSupported();
|
||||
|
||||
@ -42,7 +43,7 @@ class H264Encoder : public VideoEncoder {
|
||||
|
||||
class H264Decoder : public VideoDecoder {
|
||||
public:
|
||||
static H264Decoder* Create();
|
||||
static std::unique_ptr<H264Decoder> Create();
|
||||
static bool IsSupported();
|
||||
|
||||
~H264Decoder() override {}
|
||||
|
||||
@ -16,11 +16,13 @@ namespace webrtc {
|
||||
|
||||
class TestH264Impl : public VideoCodecTest {
|
||||
protected:
|
||||
VideoEncoder* CreateEncoder() override {
|
||||
std::unique_ptr<VideoEncoder> CreateEncoder() override {
|
||||
return H264Encoder::Create(cricket::VideoCodec(cricket::kH264CodecName));
|
||||
}
|
||||
|
||||
VideoDecoder* CreateDecoder() override { return H264Decoder::Create(); }
|
||||
std::unique_ptr<VideoDecoder> CreateDecoder() override {
|
||||
return H264Decoder::Create();
|
||||
}
|
||||
|
||||
VideoCodec codec_settings() override {
|
||||
VideoCodec codec_inst;
|
||||
|
||||
Reference in New Issue
Block a user