Unify VideoCodecType to/from string functionality
BUG=None Review-Url: https://codereview.webrtc.org/2509273002 Cr-Commit-Position: refs/heads/master@{#15200}
This commit is contained in:
@ -393,7 +393,8 @@ int32_t MediaCodecVideoEncoder::InitEncode(
|
|||||||
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
|
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
|
||||||
}
|
}
|
||||||
// Factory should guard against other codecs being used with us.
|
// Factory should guard against other codecs being used with us.
|
||||||
const VideoCodecType codec_type = cricket::CodecTypeFromName(codec_.name);
|
const VideoCodecType codec_type = webrtc::PayloadNameToCodecType(codec_.name)
|
||||||
|
.value_or(webrtc::kVideoCodecUnknown);
|
||||||
RTC_CHECK(codec_settings->codecType == codec_type)
|
RTC_CHECK(codec_settings->codecType == codec_type)
|
||||||
<< "Unsupported codec " << codec_settings->codecType << " for "
|
<< "Unsupported codec " << codec_settings->codecType << " for "
|
||||||
<< codec_type;
|
<< codec_type;
|
||||||
@ -552,7 +553,8 @@ int32_t MediaCodecVideoEncoder::InitEncodeOnCodecThread(
|
|||||||
JNIEnv* jni = AttachCurrentThreadIfNeeded();
|
JNIEnv* jni = AttachCurrentThreadIfNeeded();
|
||||||
ScopedLocalRefFrame local_ref_frame(jni);
|
ScopedLocalRefFrame local_ref_frame(jni);
|
||||||
|
|
||||||
const VideoCodecType codec_type = cricket::CodecTypeFromName(codec_.name);
|
const VideoCodecType codec_type = webrtc::PayloadNameToCodecType(codec_.name)
|
||||||
|
.value_or(webrtc::kVideoCodecUnknown);
|
||||||
ALOGD << "InitEncodeOnCodecThread Type: " << (int)codec_type << ", " << width
|
ALOGD << "InitEncodeOnCodecThread Type: " << (int)codec_type << ", " << width
|
||||||
<< " x " << height << ". Bitrate: " << kbps << " kbps. Fps: " << fps;
|
<< " x " << height << ". Bitrate: " << kbps << " kbps. Fps: " << fps;
|
||||||
if (kbps == 0) {
|
if (kbps == 0) {
|
||||||
@ -1067,7 +1069,9 @@ bool MediaCodecVideoEncoder::DeliverPendingOutputs(JNIEnv* jni) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Callback - return encoded frame.
|
// Callback - return encoded frame.
|
||||||
const VideoCodecType codec_type = cricket::CodecTypeFromName(codec_.name);
|
const VideoCodecType codec_type =
|
||||||
|
webrtc::PayloadNameToCodecType(codec_.name)
|
||||||
|
.value_or(webrtc::kVideoCodecUnknown);
|
||||||
webrtc::EncodedImageCallback::Result callback_result(
|
webrtc::EncodedImageCallback::Result callback_result(
|
||||||
webrtc::EncodedImageCallback::Result::OK);
|
webrtc::EncodedImageCallback::Result::OK);
|
||||||
if (callback_) {
|
if (callback_) {
|
||||||
|
@ -8,12 +8,14 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "webrtc/base/checks.h"
|
|
||||||
#include "webrtc/common_types.h"
|
#include "webrtc/common_types.h"
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "webrtc/base/checks.h"
|
||||||
|
#include "webrtc/base/stringutils.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
StreamDataCounters::StreamDataCounters() : first_packet_time_ms(-1) {}
|
StreamDataCounters::StreamDataCounters() : first_packet_time_ms(-1) {}
|
||||||
@ -101,41 +103,45 @@ static const char* kPayloadNameRED = "RED";
|
|||||||
static const char* kPayloadNameULPFEC = "ULPFEC";
|
static const char* kPayloadNameULPFEC = "ULPFEC";
|
||||||
static const char* kPayloadNameGeneric = "Generic";
|
static const char* kPayloadNameGeneric = "Generic";
|
||||||
|
|
||||||
rtc::Optional<std::string> CodecTypeToPayloadName(VideoCodecType type) {
|
static bool CodecNamesEq(const char* name1, const char* name2) {
|
||||||
|
return _stricmp(name1, name2) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
rtc::Optional<const char*> CodecTypeToPayloadName(VideoCodecType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case kVideoCodecVP8:
|
case kVideoCodecVP8:
|
||||||
return rtc::Optional<std::string>(kPayloadNameVp8);
|
return rtc::Optional<const char*>(kPayloadNameVp8);
|
||||||
case kVideoCodecVP9:
|
case kVideoCodecVP9:
|
||||||
return rtc::Optional<std::string>(kPayloadNameVp9);
|
return rtc::Optional<const char*>(kPayloadNameVp9);
|
||||||
case kVideoCodecH264:
|
case kVideoCodecH264:
|
||||||
return rtc::Optional<std::string>(kPayloadNameH264);
|
return rtc::Optional<const char*>(kPayloadNameH264);
|
||||||
case kVideoCodecI420:
|
case kVideoCodecI420:
|
||||||
return rtc::Optional<std::string>(kPayloadNameI420);
|
return rtc::Optional<const char*>(kPayloadNameI420);
|
||||||
case kVideoCodecRED:
|
case kVideoCodecRED:
|
||||||
return rtc::Optional<std::string>(kPayloadNameRED);
|
return rtc::Optional<const char*>(kPayloadNameRED);
|
||||||
case kVideoCodecULPFEC:
|
case kVideoCodecULPFEC:
|
||||||
return rtc::Optional<std::string>(kPayloadNameULPFEC);
|
return rtc::Optional<const char*>(kPayloadNameULPFEC);
|
||||||
case kVideoCodecGeneric:
|
case kVideoCodecGeneric:
|
||||||
return rtc::Optional<std::string>(kPayloadNameGeneric);
|
return rtc::Optional<const char*>(kPayloadNameGeneric);
|
||||||
default:
|
default:
|
||||||
return rtc::Optional<std::string>();
|
return rtc::Optional<const char*>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::Optional<VideoCodecType> PayloadNameToCodecType(const std::string& name) {
|
rtc::Optional<VideoCodecType> PayloadNameToCodecType(const std::string& name) {
|
||||||
if (name == kPayloadNameVp8)
|
if (CodecNamesEq(name.c_str(), kPayloadNameVp8))
|
||||||
return rtc::Optional<VideoCodecType>(kVideoCodecVP8);
|
return rtc::Optional<VideoCodecType>(kVideoCodecVP8);
|
||||||
if (name == kPayloadNameVp9)
|
if (CodecNamesEq(name.c_str(), kPayloadNameVp9))
|
||||||
return rtc::Optional<VideoCodecType>(kVideoCodecVP9);
|
return rtc::Optional<VideoCodecType>(kVideoCodecVP9);
|
||||||
if (name == kPayloadNameH264)
|
if (CodecNamesEq(name.c_str(), kPayloadNameH264))
|
||||||
return rtc::Optional<VideoCodecType>(kVideoCodecH264);
|
return rtc::Optional<VideoCodecType>(kVideoCodecH264);
|
||||||
if (name == kPayloadNameI420)
|
if (CodecNamesEq(name.c_str(), kPayloadNameI420))
|
||||||
return rtc::Optional<VideoCodecType>(kVideoCodecI420);
|
return rtc::Optional<VideoCodecType>(kVideoCodecI420);
|
||||||
if (name == kPayloadNameRED)
|
if (CodecNamesEq(name.c_str(), kPayloadNameRED))
|
||||||
return rtc::Optional<VideoCodecType>(kVideoCodecRED);
|
return rtc::Optional<VideoCodecType>(kVideoCodecRED);
|
||||||
if (name == kPayloadNameULPFEC)
|
if (CodecNamesEq(name.c_str(), kPayloadNameULPFEC))
|
||||||
return rtc::Optional<VideoCodecType>(kVideoCodecULPFEC);
|
return rtc::Optional<VideoCodecType>(kVideoCodecULPFEC);
|
||||||
if (name == kPayloadNameGeneric)
|
if (CodecNamesEq(name.c_str(), kPayloadNameGeneric))
|
||||||
return rtc::Optional<VideoCodecType>(kVideoCodecGeneric);
|
return rtc::Optional<VideoCodecType>(kVideoCodecGeneric);
|
||||||
return rtc::Optional<VideoCodecType>();
|
return rtc::Optional<VideoCodecType>();
|
||||||
}
|
}
|
||||||
|
@ -573,7 +573,7 @@ enum VideoCodecType {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Translates from name of codec to codec type and vice versa.
|
// Translates from name of codec to codec type and vice versa.
|
||||||
rtc::Optional<std::string> CodecTypeToPayloadName(VideoCodecType type);
|
rtc::Optional<const char*> CodecTypeToPayloadName(VideoCodecType type);
|
||||||
rtc::Optional<VideoCodecType> PayloadNameToCodecType(const std::string& name);
|
rtc::Optional<VideoCodecType> PayloadNameToCodecType(const std::string& name);
|
||||||
|
|
||||||
union VideoCodecUnion {
|
union VideoCodecUnion {
|
||||||
|
@ -324,17 +324,6 @@ bool CodecNamesEq(const char* name1, const char* name2) {
|
|||||||
return _stricmp(name1, name2) == 0;
|
return _stricmp(name1, name2) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
webrtc::VideoCodecType CodecTypeFromName(const std::string& name) {
|
|
||||||
if (CodecNamesEq(name.c_str(), kVp8CodecName)) {
|
|
||||||
return webrtc::kVideoCodecVP8;
|
|
||||||
} else if (CodecNamesEq(name.c_str(), kVp9CodecName)) {
|
|
||||||
return webrtc::kVideoCodecVP9;
|
|
||||||
} else if (CodecNamesEq(name.c_str(), kH264CodecName)) {
|
|
||||||
return webrtc::kVideoCodecH264;
|
|
||||||
}
|
|
||||||
return webrtc::kVideoCodecUnknown;
|
|
||||||
}
|
|
||||||
|
|
||||||
const VideoCodec* FindMatchingCodec(
|
const VideoCodec* FindMatchingCodec(
|
||||||
const std::vector<VideoCodec>& supported_codecs,
|
const std::vector<VideoCodec>& supported_codecs,
|
||||||
const VideoCodec& codec) {
|
const VideoCodec& codec) {
|
||||||
|
@ -212,7 +212,6 @@ const Codec* FindCodecById(const std::vector<Codec>& codecs, int payload_type) {
|
|||||||
|
|
||||||
bool CodecNamesEq(const std::string& name1, const std::string& name2);
|
bool CodecNamesEq(const std::string& name1, const std::string& name2);
|
||||||
bool CodecNamesEq(const char* name1, const char* name2);
|
bool CodecNamesEq(const char* name1, const char* name2);
|
||||||
webrtc::VideoCodecType CodecTypeFromName(const std::string& name);
|
|
||||||
bool HasNack(const Codec& codec);
|
bool HasNack(const Codec& codec);
|
||||||
bool HasRemb(const Codec& codec);
|
bool HasRemb(const Codec& codec);
|
||||||
bool HasTransportCc(const Codec& codec);
|
bool HasTransportCc(const Codec& codec);
|
||||||
|
@ -64,7 +64,10 @@ InternalEncoderFactory::~InternalEncoderFactory() {}
|
|||||||
// WebRtcVideoEncoderFactory implementation.
|
// WebRtcVideoEncoderFactory implementation.
|
||||||
webrtc::VideoEncoder* InternalEncoderFactory::CreateVideoEncoder(
|
webrtc::VideoEncoder* InternalEncoderFactory::CreateVideoEncoder(
|
||||||
const cricket::VideoCodec& codec) {
|
const cricket::VideoCodec& codec) {
|
||||||
switch (CodecTypeFromName(codec.name)) {
|
const webrtc::VideoCodecType codec_type =
|
||||||
|
webrtc::PayloadNameToCodecType(codec.name)
|
||||||
|
.value_or(webrtc::kVideoCodecUnknown);
|
||||||
|
switch (codec_type) {
|
||||||
case webrtc::kVideoCodecH264:
|
case webrtc::kVideoCodecH264:
|
||||||
return webrtc::H264Encoder::Create();
|
return webrtc::H264Encoder::Create();
|
||||||
case webrtc::kVideoCodecVP8:
|
case webrtc::kVideoCodecVP8:
|
||||||
|
@ -10,26 +10,14 @@
|
|||||||
|
|
||||||
#include "webrtc/media/engine/webrtcvideoencoderfactory.h"
|
#include "webrtc/media/engine/webrtcvideoencoderfactory.h"
|
||||||
|
|
||||||
#include "webrtc/media/base/mediaconstants.h"
|
#include "webrtc/common_types.h"
|
||||||
|
|
||||||
static const char* NameFromCodecType(webrtc::VideoCodecType type) {
|
|
||||||
switch (type) {
|
|
||||||
case webrtc::kVideoCodecVP8:
|
|
||||||
return cricket::kVp8CodecName;
|
|
||||||
case webrtc::kVideoCodecVP9:
|
|
||||||
return cricket::kVp9CodecName;
|
|
||||||
case webrtc::kVideoCodecH264:
|
|
||||||
return cricket::kH264CodecName;
|
|
||||||
default:
|
|
||||||
return "Unknown codec";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace cricket {
|
namespace cricket {
|
||||||
|
|
||||||
webrtc::VideoEncoder* WebRtcVideoEncoderFactory::CreateVideoEncoder(
|
webrtc::VideoEncoder* WebRtcVideoEncoderFactory::CreateVideoEncoder(
|
||||||
const cricket::VideoCodec& codec) {
|
const cricket::VideoCodec& codec) {
|
||||||
return CreateVideoEncoder(CodecTypeFromName(codec.name));
|
return CreateVideoEncoder(webrtc::PayloadNameToCodecType(codec.name)
|
||||||
|
.value_or(webrtc::kVideoCodecUnknown));
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<cricket::VideoCodec>&
|
const std::vector<cricket::VideoCodec>&
|
||||||
@ -43,7 +31,8 @@ WebRtcVideoEncoderFactory::supported_codecs() const {
|
|||||||
|
|
||||||
webrtc::VideoEncoder* WebRtcVideoEncoderFactory::CreateVideoEncoder(
|
webrtc::VideoEncoder* WebRtcVideoEncoderFactory::CreateVideoEncoder(
|
||||||
webrtc::VideoCodecType type) {
|
webrtc::VideoCodecType type) {
|
||||||
const cricket::VideoCodec codec(NameFromCodecType(type));
|
const cricket::VideoCodec codec(
|
||||||
|
webrtc::CodecTypeToPayloadName(type).value_or("Unknown codec"));
|
||||||
return CreateVideoEncoder(codec);
|
return CreateVideoEncoder(codec);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +41,9 @@ WebRtcVideoEncoderFactory::codecs() const {
|
|||||||
const std::vector<cricket::VideoCodec>& codecs = supported_codecs();
|
const std::vector<cricket::VideoCodec>& codecs = supported_codecs();
|
||||||
for (const cricket::VideoCodec& codec : codecs) {
|
for (const cricket::VideoCodec& codec : codecs) {
|
||||||
encoder_codecs_.push_back(
|
encoder_codecs_.push_back(
|
||||||
VideoCodec(CodecTypeFromName(codec.name), codec.name));
|
VideoCodec(webrtc::PayloadNameToCodecType(codec.name)
|
||||||
|
.value_or(webrtc::kVideoCodecUnknown),
|
||||||
|
codec.name));
|
||||||
}
|
}
|
||||||
return encoder_codecs_;
|
return encoder_codecs_;
|
||||||
}
|
}
|
||||||
|
@ -1789,7 +1789,9 @@ void WebRtcVideoChannel2::WebRtcVideoSendStream::SetCodec(
|
|||||||
parameters_.config.encoder_settings.payload_name = codec_settings.codec.name;
|
parameters_.config.encoder_settings.payload_name = codec_settings.codec.name;
|
||||||
parameters_.config.encoder_settings.payload_type = codec_settings.codec.id;
|
parameters_.config.encoder_settings.payload_type = codec_settings.codec.id;
|
||||||
if (new_encoder.external) {
|
if (new_encoder.external) {
|
||||||
webrtc::VideoCodecType type = CodecTypeFromName(codec_settings.codec.name);
|
webrtc::VideoCodecType type =
|
||||||
|
webrtc::PayloadNameToCodecType(codec_settings.codec.name)
|
||||||
|
.value_or(webrtc::kVideoCodecUnknown);
|
||||||
parameters_.config.encoder_settings.internal_source =
|
parameters_.config.encoder_settings.internal_source =
|
||||||
external_encoder_factory_->EncoderTypeHasInternalSource(type);
|
external_encoder_factory_->EncoderTypeHasInternalSource(type);
|
||||||
}
|
}
|
||||||
@ -2233,7 +2235,8 @@ WebRtcVideoChannel2::WebRtcVideoReceiveStream::AllocatedDecoder
|
|||||||
WebRtcVideoChannel2::WebRtcVideoReceiveStream::CreateOrReuseVideoDecoder(
|
WebRtcVideoChannel2::WebRtcVideoReceiveStream::CreateOrReuseVideoDecoder(
|
||||||
std::vector<AllocatedDecoder>* old_decoders,
|
std::vector<AllocatedDecoder>* old_decoders,
|
||||||
const VideoCodec& codec) {
|
const VideoCodec& codec) {
|
||||||
webrtc::VideoCodecType type = CodecTypeFromName(codec.name);
|
webrtc::VideoCodecType type = webrtc::PayloadNameToCodecType(codec.name)
|
||||||
|
.value_or(webrtc::kVideoCodecUnknown);
|
||||||
|
|
||||||
for (size_t i = 0; i < old_decoders->size(); ++i) {
|
for (size_t i = 0; i < old_decoders->size(); ++i) {
|
||||||
if ((*old_decoders)[i].type == type) {
|
if ((*old_decoders)[i].type == type) {
|
||||||
|
@ -403,24 +403,6 @@ const char* ExcludeFrameTypesToStr(ExcludeFrameTypes e) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* VideoCodecTypeToStr(webrtc::VideoCodecType e) {
|
|
||||||
switch (e) {
|
|
||||||
case kVideoCodecVP8:
|
|
||||||
return "VP8";
|
|
||||||
case kVideoCodecI420:
|
|
||||||
return "I420";
|
|
||||||
case kVideoCodecRED:
|
|
||||||
return "RED";
|
|
||||||
case kVideoCodecULPFEC:
|
|
||||||
return "ULPFEC";
|
|
||||||
case kVideoCodecUnknown:
|
|
||||||
return "Unknown";
|
|
||||||
default:
|
|
||||||
RTC_NOTREACHED();
|
|
||||||
return "Unknown";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Callbacks
|
// Callbacks
|
||||||
EncodedImageCallback::Result
|
EncodedImageCallback::Result
|
||||||
VideoProcessorImpl::VideoProcessorEncodeCompleteCallback::OnEncodedImage(
|
VideoProcessorImpl::VideoProcessorEncodeCompleteCallback::OnEncodedImage(
|
||||||
|
@ -108,9 +108,6 @@ struct TestConfig {
|
|||||||
bool verbose;
|
bool verbose;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Returns a string representation of the enum value.
|
|
||||||
const char* VideoCodecTypeToStr(webrtc::VideoCodecType e);
|
|
||||||
|
|
||||||
// Handles encoding/decoding of video using the VideoEncoder/VideoDecoder
|
// Handles encoding/decoding of video using the VideoEncoder/VideoDecoder
|
||||||
// interfaces. This is done in a sequential manner in order to be able to
|
// interfaces. This is done in a sequential manner in order to be able to
|
||||||
// measure times properly.
|
// measure times properly.
|
||||||
|
@ -412,7 +412,8 @@ void PrintPythonOutput(const webrtc::test::TestConfig& config,
|
|||||||
ExcludeFrameTypesToStr(config.exclude_frame_types),
|
ExcludeFrameTypesToStr(config.exclude_frame_types),
|
||||||
config.frame_length_in_bytes, config.use_single_core ? "True " : "False",
|
config.frame_length_in_bytes, config.use_single_core ? "True " : "False",
|
||||||
config.keyframe_interval,
|
config.keyframe_interval,
|
||||||
webrtc::test::VideoCodecTypeToStr(config.codec_settings->codecType),
|
CodecTypeToPayloadName(config.codec_settings->codecType)
|
||||||
|
.value_or("Unknown"),
|
||||||
config.codec_settings->width, config.codec_settings->height,
|
config.codec_settings->width, config.codec_settings->height,
|
||||||
config.codec_settings->startBitrate);
|
config.codec_settings->startBitrate);
|
||||||
printf(
|
printf(
|
||||||
|
@ -122,20 +122,8 @@ bool IvfFileWriter::InitFromFirstFrame(const EncodedImage& encoded_image,
|
|||||||
if (!WriteHeader())
|
if (!WriteHeader())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string codec_name;
|
const char* codec_name =
|
||||||
switch (codec_type_) {
|
CodecTypeToPayloadName(codec_type_).value_or("Unknown");
|
||||||
case kVideoCodecVP8:
|
|
||||||
codec_name = "VP8";
|
|
||||||
break;
|
|
||||||
case kVideoCodecVP9:
|
|
||||||
codec_name = "VP9";
|
|
||||||
break;
|
|
||||||
case kVideoCodecH264:
|
|
||||||
codec_name = "H264";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
codec_name = "Unknown";
|
|
||||||
}
|
|
||||||
LOG(LS_WARNING) << "Created IVF file for codec data of type " << codec_name
|
LOG(LS_WARNING) << "Created IVF file for codec data of type " << codec_name
|
||||||
<< " at resolution " << width_ << " x " << height_
|
<< " at resolution " << width_ << " x " << height_
|
||||||
<< ", using " << (using_capture_timestamps_ ? "1" : "90")
|
<< ", using " << (using_capture_timestamps_ ? "1" : "90")
|
||||||
|
@ -17,21 +17,6 @@
|
|||||||
#include "webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_decoder.h"
|
#include "webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_decoder.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TODO(kthelgason): delete this when CreateVideoDecoder takes
|
|
||||||
// a cricket::VideoCodec instead of webrtc::VideoCodecType.
|
|
||||||
static const char* NameFromCodecType(webrtc::VideoCodecType type) {
|
|
||||||
switch (type) {
|
|
||||||
case webrtc::kVideoCodecVP8:
|
|
||||||
return cricket::kVp8CodecName;
|
|
||||||
case webrtc::kVideoCodecVP9:
|
|
||||||
return cricket::kVp9CodecName;
|
|
||||||
case webrtc::kVideoCodecH264:
|
|
||||||
return cricket::kH264CodecName;
|
|
||||||
default:
|
|
||||||
return "Unknown codec";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
// VideoToolboxVideoEncoderFactory
|
// VideoToolboxVideoEncoderFactory
|
||||||
@ -94,7 +79,12 @@ VideoToolboxVideoDecoderFactory::~VideoToolboxVideoDecoderFactory() {}
|
|||||||
|
|
||||||
VideoDecoder* VideoToolboxVideoDecoderFactory::CreateVideoDecoder(
|
VideoDecoder* VideoToolboxVideoDecoderFactory::CreateVideoDecoder(
|
||||||
VideoCodecType type) {
|
VideoCodecType type) {
|
||||||
const auto codec = cricket::VideoCodec(NameFromCodecType(type));
|
const rtc::Optional<const char*> codec_name = CodecTypeToPayloadName(type);
|
||||||
|
if (!codec_name) {
|
||||||
|
LOG(LS_ERROR) << "Invalid codec type: " << type;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
const cricket::VideoCodec codec(*codec_name);
|
||||||
#if defined(WEBRTC_IOS)
|
#if defined(WEBRTC_IOS)
|
||||||
if (FindMatchingCodec(supported_codecs_, codec)) {
|
if (FindMatchingCodec(supported_codecs_, codec)) {
|
||||||
LOG(LS_INFO) << "Creating HW decoder for " << codec.name;
|
LOG(LS_INFO) << "Creating HW decoder for " << codec.name;
|
||||||
|
Reference in New Issue
Block a user