Migrate test VideoDecoders to new VideoDecoder::Configure
Bug: webrtc:13045 Change-Id: I3b66270de59b441bf8b92bc10f67f59f05e9995e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228436 Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34742}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
40f7a5bab0
commit
d08930d5fb
@ -13,6 +13,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "api/video/i420_buffer.h"
|
||||
#include "api/video_codecs/video_decoder.h"
|
||||
#include "test/gmock.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/time_controller/simulated_time_controller.h"
|
||||
@ -39,10 +40,9 @@ class MockVideoStreamDecoderCallbacks
|
||||
|
||||
class StubVideoDecoder : public VideoDecoder {
|
||||
public:
|
||||
MOCK_METHOD(int32_t,
|
||||
InitDecode,
|
||||
(const VideoCodec*, int32_t number_of_cores),
|
||||
(override));
|
||||
StubVideoDecoder() { ON_CALL(*this, Configure).WillByDefault(Return(true)); }
|
||||
|
||||
MOCK_METHOD(bool, Configure, (const Settings&), (override));
|
||||
|
||||
int32_t Decode(const EncodedImage& input_image,
|
||||
bool missing_frames,
|
||||
@ -81,9 +81,8 @@ class WrappedVideoDecoder : public VideoDecoder {
|
||||
public:
|
||||
explicit WrappedVideoDecoder(StubVideoDecoder* decoder) : decoder_(decoder) {}
|
||||
|
||||
int32_t InitDecode(const VideoCodec* codec_settings,
|
||||
int32_t number_of_cores) override {
|
||||
return decoder_->InitDecode(codec_settings, number_of_cores);
|
||||
bool Configure(const Settings& settings) override {
|
||||
return decoder_->Configure(settings);
|
||||
}
|
||||
int32_t Decode(const EncodedImage& input_image,
|
||||
bool missing_frames,
|
||||
@ -203,8 +202,8 @@ TEST_F(VideoStreamDecoderImplTest, InsertAndDecodeFrameWithKeyframeRequest) {
|
||||
|
||||
TEST_F(VideoStreamDecoderImplTest, FailToInitDecoder) {
|
||||
video_stream_decoder_.OnFrame(FrameBuilder().WithPayloadType(1).Build());
|
||||
ON_CALL(decoder_factory_.Vp8Decoder(), InitDecode)
|
||||
.WillByDefault(Return(WEBRTC_VIDEO_CODEC_ERROR));
|
||||
ON_CALL(decoder_factory_.Vp8Decoder(), Configure)
|
||||
.WillByDefault(Return(false));
|
||||
EXPECT_CALL(callbacks_, OnNonDecodableState);
|
||||
time_controller_.AdvanceTime(TimeDelta::Millis(1));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user