blob: 8a14f88231d846123993670dd69204448cb4ad29 [file] [log] [blame]
stefan@webrtc.org360e3762013-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 {
20
21class FakeEncoder : public VideoEncoder {
22 public:
23 explicit FakeEncoder(Clock* clock);
24
25 virtual ~FakeEncoder();
26
27 virtual int32_t InitEncode(const VideoCodec* config,
28 int32_t number_of_cores,
29 uint32_t max_payload_size) OVERRIDE;
30
31 virtual int32_t Encode(
32 const I420VideoFrame& input_image,
33 const CodecSpecificInfo* codec_specific_info,
34 const std::vector<VideoFrameType>* frame_types) OVERRIDE;
35
36 virtual int32_t RegisterEncodeCompleteCallback(
37 EncodedImageCallback* callback) OVERRIDE;
38
39 virtual int32_t Release() OVERRIDE;
40
41 virtual int32_t SetChannelParameters(uint32_t packet_loss, int rtt) OVERRIDE;
42
43 virtual int32_t SetRates(uint32_t new_target_bitrate,
44 uint32_t framerate) OVERRIDE;
45
46 private:
47 enum { kMaxFrameSizeBytes = 100000 };
48
49 Clock* clock_;
50 VideoCodec config_;
51 EncodedImageCallback* callback_;
52 int target_bitrate_kbps_;
53 int64_t last_encode_time_ms_;
54 uint8_t encoded_buffer_[kMaxFrameSizeBytes];
55};
56} // namespace webrtc
57
58#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_FAKE_ENCODER_H_