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

Unified Diff: modules/video_coding/codecs/stereo/stereo_adapter_unittest.cc

Issue 2951033003: [EXPERIMENTAL] Generic stereo codec with index header sending single frames
Patch Set: Rebase and add external codec support. Created 3 years, 3 months 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
Index: modules/video_coding/codecs/stereo/stereo_adapter_unittest.cc
diff --git a/modules/video_coding/codecs/stereo/stereo_adapter_unittest.cc b/modules/video_coding/codecs/stereo/stereo_adapter_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9b3dd350770d42fdbb9d23bd67a7e605a182279c
--- /dev/null
+++ b/modules/video_coding/codecs/stereo/stereo_adapter_unittest.cc
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2017 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 "common_video/libyuv/include/webrtc_libyuv.h"
+#include "modules/video_coding/codecs/stereo/include/stereo_decoder_adapter.h"
+#include "modules/video_coding/codecs/stereo/include/stereo_encoder_adapter.h"
+#include "modules/video_coding/codecs/test/video_codec_test.h"
+#include "modules/video_coding/codecs/vp9/include/vp9.h"
+
+namespace webrtc {
+
+class TestStereoEncoderFactory : public VideoEncoderFactory {
+ public:
+ VideoEncoder* Create() override { return VP9Encoder::Create(); }
+ void Destroy(VideoEncoder* encoder) override { delete encoder; }
+};
+
+class TestStereoDecoderFactory : public VideoDecoderFactory {
+ public:
+ VideoDecoder* Create() override { return VP9Decoder::Create(); }
+ void Destroy(VideoDecoder* encoder) override { delete encoder; }
+};
+
+class TestStereoAdapter : public VideoCodecTest {
+ protected:
+ VideoEncoder* CreateEncoder() override {
+ return new StereoEncoderAdapter(new TestStereoEncoderFactory());
+ }
+ VideoDecoder* CreateDecoder() override {
+ return new StereoDecoderAdapter(new TestStereoDecoderFactory());
+ }
+ VideoCodec codec_settings() override {
+ VideoCodec codec_settings;
+ codec_settings.codecType = webrtc::kVideoCodecVP9;
+ codec_settings.VP9()->numberOfTemporalLayers = 1;
+ codec_settings.VP9()->numberOfSpatialLayers = 1;
+ return codec_settings;
+ }
+};
+
+TEST_F(TestStereoAdapter, ConstructAndDestructEncoder) {
+ EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Release());
+}
+
+TEST_F(TestStereoAdapter, ConstructAndDestructDecoder) {
+ EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->Release());
+}
+
+TEST_F(TestStereoAdapter, EncodeDecodeI420Frame) {
+ EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
+ encoder_->Encode(*input_frame_, nullptr, nullptr));
+ EncodedImage encoded_frame;
+ CodecSpecificInfo codec_specific_info;
+ ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_specific_info));
+ EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
+ decoder_->Decode(encoded_frame, false, nullptr));
+ std::unique_ptr<VideoFrame> decoded_frame;
+ rtc::Optional<uint8_t> decoded_qp;
+ ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp));
+ ASSERT_TRUE(decoded_frame);
+ EXPECT_GT(I420PSNR(input_frame_.get(), decoded_frame.get()), 36);
+}
+
+} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698