webrtc_m130/media/engine/internaldecoderfactory.cc
Magnus Jedvert 34c8e6bce8 Revert "Update internal SW codecs to return unique_ptrs"
This reverts commit 4fe6adc06a8524ac25f85260bfe392eb31dae6b4.

Reason for revert: Breaks android compile.

Original change's description:
> 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}

TBR=magjed@webrtc.org,sprang@webrtc.org,stefan@webrtc.org

Change-Id: If33c3a0ee0dfce63d105558a2897a472f0633306
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:7925
Reviewed-on: https://webrtc-review.googlesource.com/22540
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20652}
2017-11-13 13:02:30 +00:00

51 lines
1.8 KiB
C++

/*
* Copyright (c) 2016 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/internaldecoderfactory.h"
#include "media/base/mediaconstants.h"
#include "modules/video_coding/codecs/h264/include/h264.h"
#include "modules/video_coding/codecs/vp8/include/vp8.h"
#include "modules/video_coding/codecs/vp9/include/vp9.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
namespace webrtc {
std::vector<SdpVideoFormat> InternalDecoderFactory::GetSupportedFormats()
const {
std::vector<SdpVideoFormat> formats;
formats.push_back(SdpVideoFormat(cricket::kVp8CodecName));
if (VP9Decoder::IsSupported())
formats.push_back(SdpVideoFormat(cricket::kVp9CodecName));
for (const SdpVideoFormat& h264_format : SupportedH264Codecs())
formats.push_back(h264_format);
return formats;
}
std::unique_ptr<VideoDecoder> InternalDecoderFactory::CreateVideoDecoder(
const SdpVideoFormat& format) {
if (cricket::CodecNamesEq(format.name, cricket::kVp8CodecName))
return std::unique_ptr<VideoDecoder>(VP8Decoder::Create());
if (cricket::CodecNamesEq(format.name, cricket::kVp9CodecName)) {
RTC_DCHECK(VP9Decoder::IsSupported());
return std::unique_ptr<VideoDecoder>(VP9Decoder::Create());
}
if (cricket::CodecNamesEq(format.name, cricket::kH264CodecName))
return std::unique_ptr<VideoDecoder>(H264Decoder::Create());
RTC_LOG(LS_ERROR) << "Trying to create decoder for unsupported format";
return nullptr;
}
} // namespace webrtc