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

Unified Diff: webrtc/video/video_encoder.cc

Issue 2513633002: Revert of Stop using hardcoded payload types for video codecs (Closed)
Patch Set: 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/video/end_to_end_tests.cc ('k') | webrtc/video/video_quality_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/video_encoder.cc
diff --git a/webrtc/video/video_encoder.cc b/webrtc/video/video_encoder.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f4e8156528bc288fb300bf2daed4461a3ec668d0
--- /dev/null
+++ b/webrtc/video/video_encoder.cc
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2015 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 "webrtc/video_encoder.h"
+
+#include "webrtc/base/checks.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/modules/video_coding/codecs/h264/include/h264.h"
+#include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
+#include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h"
+
+namespace webrtc {
+VideoEncoder* VideoEncoder::Create(VideoEncoder::EncoderType codec_type) {
+ RTC_DCHECK(IsSupportedSoftware(codec_type));
+ switch (codec_type) {
+ case kH264:
+ return H264Encoder::Create();
+ case kVp8:
+ return VP8Encoder::Create();
+ case kVp9:
+ return VP9Encoder::Create();
+ case kUnsupportedCodec:
+ RTC_NOTREACHED();
+ return nullptr;
+ }
+ RTC_NOTREACHED();
+ return nullptr;
+}
+
+bool VideoEncoder::IsSupportedSoftware(EncoderType codec_type) {
+ switch (codec_type) {
+ case kH264:
+ return H264Encoder::IsSupported();
+ case kVp8:
+ return true;
+ case kVp9:
+ return VP9Encoder::IsSupported();
+ case kUnsupportedCodec:
+ RTC_NOTREACHED();
+ return false;
+ }
+ RTC_NOTREACHED();
+ return false;
+}
+
+VideoEncoder::EncoderType VideoEncoder::CodecToEncoderType(
+ VideoCodecType codec_type) {
+ switch (codec_type) {
+ case kVideoCodecH264:
+ return VideoEncoder::kH264;
+ case kVideoCodecVP8:
+ return VideoEncoder::kVp8;
+ case kVideoCodecVP9:
+ return VideoEncoder::kVp9;
+ default:
+ return VideoEncoder::kUnsupportedCodec;
+ }
+}
+
+} // namespace webrtc
« no previous file with comments | « webrtc/video/end_to_end_tests.cc ('k') | webrtc/video/video_quality_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698