Splits vp9_impl into libvpx_vp9_encoder and libvpx_vp9_decoder.
Also moves the LibvpxVp8Interface from codec/vp8 to codec/interface and drops vp8 from the name. Follow-up CLs will wire up actual usage in the new classes through the interface so that we can unit test them more easily. Bug: webrtc:12274 Change-Id: I95f66e90245d9320e5fc23cdc845fbeb2648b38b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196522 Commit-Queue: Erik Språng <sprang@webrtc.org> Reviewed-by: Sergey Silkin <ssilkin@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32816}
This commit is contained in:
@ -1,110 +0,0 @@
|
||||
/*
|
||||
* 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 MODULES_VIDEO_CODING_CODECS_VP8_TEST_MOCK_LIBVPX_INTERFACE_H_
|
||||
#define MODULES_VIDEO_CODING_CODECS_VP8_TEST_MOCK_LIBVPX_INTERFACE_H_
|
||||
|
||||
#include "modules/video_coding/codecs/vp8/libvpx_interface.h"
|
||||
#include "test/gmock.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class MockLibvpxVp8Interface : public LibvpxInterface {
|
||||
public:
|
||||
MOCK_METHOD(
|
||||
vpx_image_t*,
|
||||
img_alloc,
|
||||
(vpx_image_t*, vpx_img_fmt_t, unsigned int, unsigned int, unsigned int),
|
||||
(const, override));
|
||||
MOCK_METHOD(vpx_image_t*,
|
||||
img_wrap,
|
||||
(vpx_image_t*,
|
||||
vpx_img_fmt_t,
|
||||
unsigned int,
|
||||
unsigned int,
|
||||
unsigned int,
|
||||
unsigned char*),
|
||||
(const, override));
|
||||
MOCK_METHOD(void, img_free, (vpx_image_t * img), (const, override));
|
||||
MOCK_METHOD(vpx_codec_err_t,
|
||||
codec_enc_config_set,
|
||||
(vpx_codec_ctx_t*, const vpx_codec_enc_cfg_t*),
|
||||
(const, override));
|
||||
MOCK_METHOD(vpx_codec_err_t,
|
||||
codec_enc_config_default,
|
||||
(vpx_codec_iface_t*, vpx_codec_enc_cfg_t*, unsigned int),
|
||||
(const, override));
|
||||
MOCK_METHOD(vpx_codec_err_t,
|
||||
codec_enc_init,
|
||||
(vpx_codec_ctx_t*,
|
||||
vpx_codec_iface_t*,
|
||||
const vpx_codec_enc_cfg_t*,
|
||||
vpx_codec_flags_t),
|
||||
(const, override));
|
||||
MOCK_METHOD(vpx_codec_err_t,
|
||||
codec_enc_init_multi,
|
||||
(vpx_codec_ctx_t*,
|
||||
vpx_codec_iface_t*,
|
||||
vpx_codec_enc_cfg_t*,
|
||||
int,
|
||||
vpx_codec_flags_t,
|
||||
vpx_rational_t*),
|
||||
(const, override));
|
||||
MOCK_METHOD(vpx_codec_err_t,
|
||||
codec_destroy,
|
||||
(vpx_codec_ctx_t*),
|
||||
(const, override));
|
||||
MOCK_METHOD(vpx_codec_err_t,
|
||||
codec_control,
|
||||
(vpx_codec_ctx_t*, vp8e_enc_control_id, uint32_t),
|
||||
(const, override));
|
||||
MOCK_METHOD(vpx_codec_err_t,
|
||||
codec_control,
|
||||
(vpx_codec_ctx_t*, vp8e_enc_control_id, int),
|
||||
(const, override));
|
||||
MOCK_METHOD(vpx_codec_err_t,
|
||||
codec_control,
|
||||
(vpx_codec_ctx_t*, vp8e_enc_control_id, int*),
|
||||
(const, override));
|
||||
MOCK_METHOD(vpx_codec_err_t,
|
||||
codec_control,
|
||||
(vpx_codec_ctx_t*, vp8e_enc_control_id, vpx_roi_map*),
|
||||
(const, override));
|
||||
MOCK_METHOD(vpx_codec_err_t,
|
||||
codec_control,
|
||||
(vpx_codec_ctx_t*, vp8e_enc_control_id, vpx_active_map*),
|
||||
(const, override));
|
||||
MOCK_METHOD(vpx_codec_err_t,
|
||||
codec_control,
|
||||
(vpx_codec_ctx_t*, vp8e_enc_control_id, vpx_scaling_mode*),
|
||||
(const, override));
|
||||
MOCK_METHOD(vpx_codec_err_t,
|
||||
codec_encode,
|
||||
(vpx_codec_ctx_t*,
|
||||
const vpx_image_t*,
|
||||
vpx_codec_pts_t,
|
||||
uint64_t,
|
||||
vpx_enc_frame_flags_t,
|
||||
uint64_t),
|
||||
(const, override));
|
||||
MOCK_METHOD(const vpx_codec_cx_pkt_t*,
|
||||
codec_get_cx_data,
|
||||
(vpx_codec_ctx_t*, vpx_codec_iter_t*),
|
||||
(const, override));
|
||||
MOCK_METHOD(const char*,
|
||||
codec_error_detail,
|
||||
(vpx_codec_ctx_t*),
|
||||
(const, override));
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // MODULES_VIDEO_CODING_CODECS_VP8_TEST_MOCK_LIBVPX_INTERFACE_H_
|
||||
@ -20,10 +20,10 @@
|
||||
#include "api/video_codecs/vp8_temporal_layers.h"
|
||||
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "common_video/test/utilities.h"
|
||||
#include "modules/video_coding/codecs/interface/mock_libvpx_interface.h"
|
||||
#include "modules/video_coding/codecs/test/video_codec_unittest.h"
|
||||
#include "modules/video_coding/codecs/vp8/include/vp8.h"
|
||||
#include "modules/video_coding/codecs/vp8/libvpx_vp8_encoder.h"
|
||||
#include "modules/video_coding/codecs/vp8/test/mock_libvpx_interface.h"
|
||||
#include "modules/video_coding/utility/vp8_header_parser.h"
|
||||
#include "rtc_base/time_utils.h"
|
||||
#include "test/field_trial.h"
|
||||
@ -120,7 +120,7 @@ class TestVp8Impl : public VideoCodecUnitTest {
|
||||
TEST_F(TestVp8Impl, ErrorResilienceDisabledForNoTemporalLayers) {
|
||||
codec_settings_.simulcastStream[0].numberOfTemporalLayers = 1;
|
||||
|
||||
auto* const vpx = new NiceMock<MockLibvpxVp8Interface>();
|
||||
auto* const vpx = new NiceMock<MockLibvpxInterface>();
|
||||
LibvpxVp8Encoder encoder((std::unique_ptr<LibvpxInterface>(vpx)),
|
||||
VP8Encoder::Settings());
|
||||
EXPECT_CALL(*vpx,
|
||||
@ -134,7 +134,7 @@ TEST_F(TestVp8Impl, DefaultErrorResilienceEnabledForTemporalLayers) {
|
||||
codec_settings_.simulcastStream[0].numberOfTemporalLayers = 2;
|
||||
codec_settings_.VP8()->numberOfTemporalLayers = 2;
|
||||
|
||||
auto* const vpx = new NiceMock<MockLibvpxVp8Interface>();
|
||||
auto* const vpx = new NiceMock<MockLibvpxInterface>();
|
||||
LibvpxVp8Encoder encoder((std::unique_ptr<LibvpxInterface>(vpx)),
|
||||
VP8Encoder::Settings());
|
||||
EXPECT_CALL(*vpx,
|
||||
@ -153,7 +153,7 @@ TEST_F(TestVp8Impl,
|
||||
codec_settings_.simulcastStream[0].numberOfTemporalLayers = 2;
|
||||
codec_settings_.VP8()->numberOfTemporalLayers = 2;
|
||||
|
||||
auto* const vpx = new NiceMock<MockLibvpxVp8Interface>();
|
||||
auto* const vpx = new NiceMock<MockLibvpxInterface>();
|
||||
LibvpxVp8Encoder encoder((std::unique_ptr<LibvpxInterface>(vpx)),
|
||||
VP8Encoder::Settings());
|
||||
EXPECT_CALL(*vpx,
|
||||
@ -166,7 +166,7 @@ TEST_F(TestVp8Impl,
|
||||
}
|
||||
|
||||
TEST_F(TestVp8Impl, SetRates) {
|
||||
auto* const vpx = new NiceMock<MockLibvpxVp8Interface>();
|
||||
auto* const vpx = new NiceMock<MockLibvpxInterface>();
|
||||
LibvpxVp8Encoder encoder((std::unique_ptr<LibvpxInterface>(vpx)),
|
||||
VP8Encoder::Settings());
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
@ -472,7 +472,7 @@ TEST_F(TestVp8Impl, DontDropKeyframes) {
|
||||
}
|
||||
|
||||
TEST_F(TestVp8Impl, KeepsTimestampOnReencode) {
|
||||
auto* const vpx = new NiceMock<MockLibvpxVp8Interface>();
|
||||
auto* const vpx = new NiceMock<MockLibvpxInterface>();
|
||||
LibvpxVp8Encoder encoder((std::unique_ptr<LibvpxInterface>(vpx)),
|
||||
VP8Encoder::Settings());
|
||||
|
||||
@ -512,7 +512,7 @@ TEST_F(TestVp8Impl, KeepsTimestampOnReencode) {
|
||||
}
|
||||
|
||||
TEST(LibvpxVp8EncoderTest, GetEncoderInfoReturnsStaticInformation) {
|
||||
auto* const vpx = new NiceMock<MockLibvpxVp8Interface>();
|
||||
auto* const vpx = new NiceMock<MockLibvpxInterface>();
|
||||
LibvpxVp8Encoder encoder((std::unique_ptr<LibvpxInterface>(vpx)),
|
||||
VP8Encoder::Settings());
|
||||
|
||||
@ -534,7 +534,7 @@ TEST(LibvpxVp8EncoderTest, RequestedResolutionAlignmentFromFieldTrial) {
|
||||
"WebRTC-VP8-GetEncoderInfoOverride/"
|
||||
"requested_resolution_alignment:10/");
|
||||
|
||||
auto* const vpx = new NiceMock<MockLibvpxVp8Interface>();
|
||||
auto* const vpx = new NiceMock<MockLibvpxInterface>();
|
||||
LibvpxVp8Encoder encoder((std::unique_ptr<LibvpxInterface>(vpx)),
|
||||
VP8Encoder::Settings());
|
||||
|
||||
@ -543,7 +543,7 @@ TEST(LibvpxVp8EncoderTest, RequestedResolutionAlignmentFromFieldTrial) {
|
||||
|
||||
TEST(LibvpxVp8EncoderTest,
|
||||
GetEncoderInfoReturnsEmptyResolutionBitrateLimitsByDefault) {
|
||||
auto* const vpx = new NiceMock<MockLibvpxVp8Interface>();
|
||||
auto* const vpx = new NiceMock<MockLibvpxInterface>();
|
||||
LibvpxVp8Encoder encoder((std::unique_ptr<LibvpxInterface>(vpx)),
|
||||
VP8Encoder::Settings());
|
||||
|
||||
@ -563,7 +563,7 @@ TEST(LibvpxVp8EncoderTest,
|
||||
VP8Encoder::Settings settings;
|
||||
settings.resolution_bitrate_limits = resolution_bitrate_limits;
|
||||
|
||||
auto* const vpx = new NiceMock<MockLibvpxVp8Interface>();
|
||||
auto* const vpx = new NiceMock<MockLibvpxInterface>();
|
||||
LibvpxVp8Encoder encoder((std::unique_ptr<LibvpxInterface>(vpx)),
|
||||
std::move(settings));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user