blob: c57a4dceb7b9894d3272ac3d15b59f5121563c7c [file] [log] [blame]
stefan@webrtc.org55afdbe2013-08-22 09:29:56 +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
11#ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_FAKE_ENCODER_H_
12#define WEBRTC_VIDEO_ENGINE_TEST_COMMON_FAKE_ENCODER_H_
13
14#include <vector>
15
16#include "webrtc/modules/video_coding/codecs/interface/video_codec_interface.h"
17#include "webrtc/system_wrappers/interface/clock.h"
18
19namespace webrtc {
pbos@webrtc.org9e709402013-09-03 09:10:37 +000020namespace test {
stefan@webrtc.org55afdbe2013-08-22 09:29:56 +000021
22class FakeEncoder : public VideoEncoder {
23 public:
24 explicit FakeEncoder(Clock* clock);
stefan@webrtc.org55afdbe2013-08-22 09:29:56 +000025 virtual ~FakeEncoder();
26
pbos@webrtc.org618a0ec2013-09-09 08:26:30 +000027 static void SetCodecSettings(VideoCodec* codec, size_t num_streams);
pbos@webrtc.org9e709402013-09-03 09:10:37 +000028
stefan@webrtc.org55afdbe2013-08-22 09:29:56 +000029 virtual int32_t InitEncode(const VideoCodec* config,
30 int32_t number_of_cores,
31 uint32_t max_payload_size) OVERRIDE;
32
33 virtual int32_t Encode(
34 const I420VideoFrame& input_image,
35 const CodecSpecificInfo* codec_specific_info,
36 const std::vector<VideoFrameType>* frame_types) OVERRIDE;
37
38 virtual int32_t RegisterEncodeCompleteCallback(
39 EncodedImageCallback* callback) OVERRIDE;
40
41 virtual int32_t Release() OVERRIDE;
42
43 virtual int32_t SetChannelParameters(uint32_t packet_loss, int rtt) OVERRIDE;
44
45 virtual int32_t SetRates(uint32_t new_target_bitrate,
46 uint32_t framerate) OVERRIDE;
47
48 private:
stefan@webrtc.org55afdbe2013-08-22 09:29:56 +000049 Clock* clock_;
50 VideoCodec config_;
51 EncodedImageCallback* callback_;
52 int target_bitrate_kbps_;
53 int64_t last_encode_time_ms_;
pbos@webrtc.org0f911c92013-08-22 12:34:58 +000054 uint8_t encoded_buffer_[100000];
stefan@webrtc.org55afdbe2013-08-22 09:29:56 +000055};
pbos@webrtc.org9e709402013-09-03 09:10:37 +000056} // namespace test
stefan@webrtc.org55afdbe2013-08-22 09:29:56 +000057} // namespace webrtc
58
59#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_FAKE_ENCODER_H_