Ilya Nikolaevskiy | b0588e6 | 2018-08-27 14:12:27 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #ifndef TEST_FAKE_VP8_ENCODER_H_ |
| 12 | #define TEST_FAKE_VP8_ENCODER_H_ |
| 13 | |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 14 | #include <stddef.h> |
| 15 | #include <stdint.h> |
Elad Alon | cde8ab2 | 2019-03-20 11:56:20 +0100 | [diff] [blame] | 16 | |
Ilya Nikolaevskiy | b0588e6 | 2018-08-27 14:12:27 +0200 | [diff] [blame] | 17 | #include <memory> |
Ilya Nikolaevskiy | b0588e6 | 2018-08-27 14:12:27 +0200 | [diff] [blame] | 18 | |
Elad Alon | 45befc5 | 2019-07-02 11:20:09 +0200 | [diff] [blame] | 19 | #include "api/fec_controller_override.h" |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 20 | #include "api/video/encoded_image.h" |
| 21 | #include "api/video_codecs/video_codec.h" |
| 22 | #include "api/video_codecs/video_encoder.h" |
Elad Alon | cde8ab2 | 2019-03-20 11:56:20 +0100 | [diff] [blame] | 23 | #include "api/video_codecs/vp8_frame_buffer_controller.h" |
Erik Språng | 4529fbc | 2018-10-12 10:30:31 +0200 | [diff] [blame] | 24 | #include "api/video_codecs/vp8_temporal_layers.h" |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 25 | #include "modules/include/module_common_types.h" |
| 26 | #include "modules/video_coding/include/video_codec_interface.h" |
Sebastian Jansson | b55015e | 2019-04-09 13:44:04 +0200 | [diff] [blame] | 27 | #include "rtc_base/synchronization/sequence_checker.h" |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 28 | #include "rtc_base/thread_annotations.h" |
| 29 | #include "system_wrappers/include/clock.h" |
| 30 | #include "test/fake_encoder.h" |
Ilya Nikolaevskiy | b0588e6 | 2018-08-27 14:12:27 +0200 | [diff] [blame] | 31 | |
| 32 | namespace webrtc { |
| 33 | namespace test { |
| 34 | |
Niels Möller | d738071 | 2019-03-06 10:09:47 +0100 | [diff] [blame] | 35 | class FakeVP8Encoder : public FakeEncoder { |
Ilya Nikolaevskiy | b0588e6 | 2018-08-27 14:12:27 +0200 | [diff] [blame] | 36 | public: |
| 37 | explicit FakeVP8Encoder(Clock* clock); |
| 38 | virtual ~FakeVP8Encoder() = default; |
| 39 | |
Ilya Nikolaevskiy | b0588e6 | 2018-08-27 14:12:27 +0200 | [diff] [blame] | 40 | int32_t InitEncode(const VideoCodec* config, |
Elad Alon | 370f93a | 2019-06-11 14:57:57 +0200 | [diff] [blame] | 41 | const Settings& settings) override; |
Ilya Nikolaevskiy | b0588e6 | 2018-08-27 14:12:27 +0200 | [diff] [blame] | 42 | |
| 43 | int32_t Release() override; |
| 44 | |
Erik Språng | 86336a5 | 2018-11-15 15:38:05 +0100 | [diff] [blame] | 45 | EncoderInfo GetEncoderInfo() const override; |
| 46 | |
Ilya Nikolaevskiy | b0588e6 | 2018-08-27 14:12:27 +0200 | [diff] [blame] | 47 | private: |
Ilya Nikolaevskiy | b0588e6 | 2018-08-27 14:12:27 +0200 | [diff] [blame] | 48 | void PopulateCodecSpecific(CodecSpecificInfo* codec_specific, |
Erik Språng | 59021ba | 2018-10-03 11:05:16 +0200 | [diff] [blame] | 49 | size_t size_bytes, |
Niels Möller | 87e2d78 | 2019-03-07 10:18:23 +0100 | [diff] [blame] | 50 | VideoFrameType frame_type, |
Ilya Nikolaevskiy | b0588e6 | 2018-08-27 14:12:27 +0200 | [diff] [blame] | 51 | int stream_idx, |
| 52 | uint32_t timestamp); |
| 53 | |
Niels Möller | d738071 | 2019-03-06 10:09:47 +0100 | [diff] [blame] | 54 | std::unique_ptr<RTPFragmentationHeader> EncodeHook( |
| 55 | EncodedImage* encoded_image, |
| 56 | CodecSpecificInfo* codec_specific) override; |
| 57 | |
Sebastian Jansson | b55015e | 2019-04-09 13:44:04 +0200 | [diff] [blame] | 58 | SequenceChecker sequence_checker_; |
Ilya Nikolaevskiy | b0588e6 | 2018-08-27 14:12:27 +0200 | [diff] [blame] | 59 | |
Elad Alon | 45befc5 | 2019-07-02 11:20:09 +0200 | [diff] [blame] | 60 | class FakeFecControllerOverride : public FecControllerOverride { |
| 61 | public: |
| 62 | ~FakeFecControllerOverride() override = default; |
| 63 | |
| 64 | void SetFecAllowed(bool fec_allowed) override {} |
| 65 | }; |
| 66 | |
| 67 | FakeFecControllerOverride fec_controller_override_ |
| 68 | RTC_GUARDED_BY(sequence_checker_); |
| 69 | |
Elad Alon | cde8ab2 | 2019-03-20 11:56:20 +0100 | [diff] [blame] | 70 | std::unique_ptr<Vp8FrameBufferController> frame_buffer_controller_ |
Ilya Nikolaevskiy | b0588e6 | 2018-08-27 14:12:27 +0200 | [diff] [blame] | 71 | RTC_GUARDED_BY(sequence_checker_); |
| 72 | }; |
| 73 | |
| 74 | } // namespace test |
| 75 | } // namespace webrtc |
| 76 | |
| 77 | #endif // TEST_FAKE_VP8_ENCODER_H_ |