blob: a9e6f50e16af032fbd2b49bd9a397c27a4f6cfac [file] [log] [blame]
pbos@webrtc.org618a0ec2013-09-09 08:26:30 +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
pbos@webrtc.org24e20892013-10-28 16:32:01 +000011#include "webrtc/test/fake_decoder.h"
pbos@webrtc.org618a0ec2013-09-09 08:26:30 +000012
13#include "testing/gtest/include/gtest/gtest.h"
14
15namespace webrtc {
16namespace test {
17
18FakeDecoder::FakeDecoder() : callback_(NULL) {}
19
20int32_t FakeDecoder::InitDecode(const VideoCodec* config,
21 int32_t number_of_cores) {
22 config_ = *config;
23 size_t width = config->width;
24 size_t height = config->height;
25 frame_.CreateEmptyFrame(static_cast<int>(width),
26 static_cast<int>(height),
27 static_cast<int>(width),
28 static_cast<int>((width + 1) / 2),
29 static_cast<int>((width + 1) / 2));
30 return WEBRTC_VIDEO_CODEC_OK;
31}
32
33int32_t FakeDecoder::Decode(const EncodedImage& input,
34 bool missing_frames,
35 const RTPFragmentationHeader* fragmentation,
36 const CodecSpecificInfo* codec_specific_info,
37 int64_t render_time_ms) {
38 frame_.set_timestamp(input._timeStamp);
39 frame_.set_render_time_ms(render_time_ms);
40
41 callback_->Decoded(frame_);
42
43 return WEBRTC_VIDEO_CODEC_OK;
44}
45
46int32_t FakeDecoder::RegisterDecodeCompleteCallback(
47 DecodedImageCallback* callback) {
48 callback_ = callback;
49 return WEBRTC_VIDEO_CODEC_OK;
50}
51
52int32_t FakeDecoder::Release() {
53 return WEBRTC_VIDEO_CODEC_OK;
54}
55int32_t FakeDecoder::Reset() {
56 return WEBRTC_VIDEO_CODEC_OK;
57}
58
59} // namespace test
60} // namespace webrtc