Move MockVideoDecoder to api/test.
Move MockVideoDecoder from
modules/video_coding/include/mock/mock_video_codec_interface.h
to
api/test/mock_video_decoder.h
The mock encoder has already moved:
https://webrtc-review.googlesource.com/c/src/+/105620
Keeping the old header until downstream projects have been updated.
Bug: webrtc:9722
Change-Id: I4bc849173a04813064212f17761876695ca3fed4
Reviewed-on: https://webrtc-review.googlesource.com/c/105900
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25170}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 0727d82..ac3e308 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -517,7 +517,24 @@
]
}
+ rtc_source_set("mock_video_decoder") {
+ visibility = [ "*" ]
+
+ testonly = true
+ sources = [
+ "test/mock_video_decoder.cc",
+ "test/mock_video_decoder.h",
+ ]
+
+ deps = [
+ "../api/video_codecs:video_codecs_api",
+ "../test:test_support",
+ ]
+ }
+
rtc_source_set("mock_video_encoder") {
+ visibility = [ "*" ]
+
testonly = true
sources = [
"test/mock_video_encoder.cc",
diff --git a/api/test/mock_video_decoder.cc b/api/test/mock_video_decoder.cc
new file mode 100644
index 0000000..85ed0e1
--- /dev/null
+++ b/api/test/mock_video_decoder.cc
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2018 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 "api/test/mock_video_decoder.h"
+
+namespace webrtc {
+
+MockDecodedImageCallback::MockDecodedImageCallback() = default;
+MockDecodedImageCallback::~MockDecodedImageCallback() = default;
+MockVideoDecoder::MockVideoDecoder() = default;
+MockVideoDecoder::~MockVideoDecoder() = default;
+
+} // namespace webrtc
diff --git a/api/test/mock_video_decoder.h b/api/test/mock_video_decoder.h
new file mode 100644
index 0000000..56ff546
--- /dev/null
+++ b/api/test/mock_video_decoder.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2018 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.
+ */
+
+#ifndef API_TEST_MOCK_VIDEO_DECODER_H_
+#define API_TEST_MOCK_VIDEO_DECODER_H_
+
+#include "api/video_codecs/video_decoder.h"
+#include "test/gmock.h"
+
+namespace webrtc {
+
+class MockDecodedImageCallback : public DecodedImageCallback {
+ public:
+ MockDecodedImageCallback();
+ ~MockDecodedImageCallback() override;
+
+ MOCK_METHOD1(Decoded, int32_t(VideoFrame& decodedImage)); // NOLINT
+ MOCK_METHOD2(Decoded,
+ int32_t(VideoFrame& decodedImage, // NOLINT
+ int64_t decode_time_ms));
+ MOCK_METHOD3(Decoded,
+ void(VideoFrame& decodedImage, // NOLINT
+ absl::optional<int32_t> decode_time_ms,
+ absl::optional<uint8_t> qp));
+ MOCK_METHOD1(ReceivedDecodedReferenceFrame,
+ int32_t(const uint64_t pictureId));
+ MOCK_METHOD1(ReceivedDecodedFrame, int32_t(const uint64_t pictureId));
+};
+
+class MockVideoDecoder : public VideoDecoder {
+ public:
+ MockVideoDecoder();
+ ~MockVideoDecoder() override;
+
+ MOCK_METHOD2(InitDecode,
+ int32_t(const VideoCodec* codecSettings, int32_t numberOfCores));
+ MOCK_METHOD4(Decode,
+ int32_t(const EncodedImage& inputImage,
+ bool missingFrames,
+ const CodecSpecificInfo* codecSpecificInfo,
+ int64_t renderTimeMs));
+ MOCK_METHOD1(RegisterDecodeCompleteCallback,
+ int32_t(DecodedImageCallback* callback));
+ MOCK_METHOD0(Release, int32_t());
+ MOCK_METHOD0(Copy, VideoDecoder*());
+};
+
+} // namespace webrtc
+
+#endif // API_TEST_MOCK_VIDEO_DECODER_H_