• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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_TEST_FAKE_DECODER_H_
12 #define WEBRTC_TEST_FAKE_DECODER_H_
13 
14 #include <vector>
15 
16 #include "webrtc/modules/video_coding/include/video_codec_interface.h"
17 #include "webrtc/system_wrappers/include/clock.h"
18 
19 namespace webrtc {
20 namespace test {
21 
22 class FakeDecoder : public VideoDecoder {
23  public:
24   FakeDecoder();
~FakeDecoder()25   virtual ~FakeDecoder() {}
26 
27   int32_t InitDecode(const VideoCodec* config,
28                      int32_t number_of_cores) override;
29 
30   int32_t Decode(const EncodedImage& input,
31                  bool missing_frames,
32                  const RTPFragmentationHeader* fragmentation,
33                  const CodecSpecificInfo* codec_specific_info,
34                  int64_t render_time_ms) override;
35 
36   int32_t RegisterDecodeCompleteCallback(
37       DecodedImageCallback* callback) override;
38 
39   int32_t Release() override;
40   int32_t Reset() override;
41 
42   const char* ImplementationName() const override;
43 
44   static const char* kImplementationName;
45 
46  private:
47   VideoCodec config_;
48   VideoFrame frame_;
49   DecodedImageCallback* callback_;
50 };
51 
52 class FakeH264Decoder : public FakeDecoder {
53  public:
~FakeH264Decoder()54   virtual ~FakeH264Decoder() {}
55 
56   int32_t Decode(const EncodedImage& input,
57                  bool missing_frames,
58                  const RTPFragmentationHeader* fragmentation,
59                  const CodecSpecificInfo* codec_specific_info,
60                  int64_t render_time_ms) override;
61 };
62 
63 class FakeNullDecoder : public FakeDecoder {
64  public:
~FakeNullDecoder()65   virtual ~FakeNullDecoder() {}
66 
Decode(const EncodedImage & input,bool missing_frames,const RTPFragmentationHeader * fragmentation,const CodecSpecificInfo * codec_specific_info,int64_t render_time_ms)67   int32_t Decode(const EncodedImage& input,
68                  bool missing_frames,
69                  const RTPFragmentationHeader* fragmentation,
70                  const CodecSpecificInfo* codec_specific_info,
71                  int64_t render_time_ms) override {
72     return 0;
73   }
74 };
75 }  // namespace test
76 }  // namespace webrtc
77 
78 #endif  // WEBRTC_TEST_FAKE_DECODER_H_
79