Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(480)

Unified Diff: webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.cc

Issue 2509273002: Unify VideoCodecType to/from string functionality (Closed)
Patch Set: Rebase and update unknown string in WebRtcVideoEncoderFactory Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/video_coding/utility/ivf_file_writer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.cc
diff --git a/webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.cc b/webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.cc
index 4bf7a4d5595503d8967ce2300b116611a9815c0c..8acc1f6e681d9544c406c56ee6684d1fed215035 100644
--- a/webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.cc
+++ b/webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.cc
@@ -17,21 +17,6 @@
#include "webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_decoder.h"
#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 {
// VideoToolboxVideoEncoderFactory
@@ -94,7 +79,12 @@ VideoToolboxVideoDecoderFactory::~VideoToolboxVideoDecoderFactory() {}
VideoDecoder* VideoToolboxVideoDecoderFactory::CreateVideoDecoder(
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 (FindMatchingCodec(supported_codecs_, codec)) {
LOG(LS_INFO) << "Creating HW decoder for " << codec.name;
« no previous file with comments | « webrtc/modules/video_coding/utility/ivf_file_writer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698