blob: 8d3cbc65afef3b5ddd87fb9743c999660fe84ebd [file] [log] [blame]
sprang@webrtc.org8b881922013-12-10 10:05:17 +00001/*
2 * Copyright (c) 2013 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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef TEST_CONFIGURABLE_FRAME_SIZE_ENCODER_H_
12#define TEST_CONFIGURABLE_FRAME_SIZE_ENCODER_H_
sprang@webrtc.org8b881922013-12-10 10:05:17 +000013
kwibergbfefb032016-05-01 14:53:46 -070014#include <memory>
sprang@webrtc.org8b881922013-12-10 10:05:17 +000015#include <vector>
16
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020017#include "api/video_codecs/video_encoder.h"
sprang@webrtc.org8b881922013-12-10 10:05:17 +000018
19namespace webrtc {
20namespace test {
21
22class ConfigurableFrameSizeEncoder : public VideoEncoder {
23 public:
pkasting@chromium.org4591fbd2014-11-20 22:28:14 +000024 explicit ConfigurableFrameSizeEncoder(size_t max_frame_size);
sprang@webrtc.org8b881922013-12-10 10:05:17 +000025 virtual ~ConfigurableFrameSizeEncoder();
26
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000027 int32_t InitEncode(const VideoCodec* codec_settings,
28 int32_t number_of_cores,
29 size_t max_payload_size) override;
sprang@webrtc.org8b881922013-12-10 10:05:17 +000030
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -070031 int32_t Encode(const VideoFrame& input_image,
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000032 const CodecSpecificInfo* codec_specific_info,
pbos22993e12015-10-19 02:39:06 -070033 const std::vector<FrameType>* frame_types) override;
sprang@webrtc.org8b881922013-12-10 10:05:17 +000034
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000035 int32_t RegisterEncodeCompleteCallback(
36 EncodedImageCallback* callback) override;
sprang@webrtc.org8b881922013-12-10 10:05:17 +000037
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000038 int32_t Release() override;
sprang@webrtc.org8b881922013-12-10 10:05:17 +000039
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000040 int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
sprang@webrtc.org8b881922013-12-10 10:05:17 +000041
Erik Språng08127a92016-11-16 16:41:30 +010042 int32_t SetRateAllocation(const BitrateAllocation& allocation,
43 uint32_t framerate) override;
sprang@webrtc.org8b881922013-12-10 10:05:17 +000044
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000045 int32_t SetPeriodicKeyFrames(bool enable) override;
sprang@webrtc.org8b881922013-12-10 10:05:17 +000046
pkasting@chromium.org4591fbd2014-11-20 22:28:14 +000047 int32_t SetFrameSize(size_t size);
sprang@webrtc.org8b881922013-12-10 10:05:17 +000048
49 private:
50 EncodedImageCallback* callback_;
pkasting@chromium.org4591fbd2014-11-20 22:28:14 +000051 const size_t max_frame_size_;
52 size_t current_frame_size_;
kwibergbfefb032016-05-01 14:53:46 -070053 std::unique_ptr<uint8_t[]> buffer_;
sprang@webrtc.org8b881922013-12-10 10:05:17 +000054};
55
56} // namespace test
57} // namespace webrtc
58
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020059#endif // TEST_CONFIGURABLE_FRAME_SIZE_ENCODER_H_