| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_ | 5 #ifndef MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_ |
| 6 #define MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_ | 6 #define MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 class FakeVideoDecoder : public VideoDecoder { | 32 class FakeVideoDecoder : public VideoDecoder { |
| 33 public: | 33 public: |
| 34 // Constructs an object with a decoding delay of |decoding_delay| frames. | 34 // Constructs an object with a decoding delay of |decoding_delay| frames. |
| 35 // |bytes_decoded_cb| is called after each decode. The sum of the byte | 35 // |bytes_decoded_cb| is called after each decode. The sum of the byte |
| 36 // count over all calls will be equal to total_bytes_decoded(). | 36 // count over all calls will be equal to total_bytes_decoded(). |
| 37 FakeVideoDecoder(int decoding_delay, | 37 FakeVideoDecoder(int decoding_delay, |
| 38 int max_parallel_decoding_requests, | 38 int max_parallel_decoding_requests, |
| 39 const BytesDecodedCB& bytes_decoded_cb); | 39 const BytesDecodedCB& bytes_decoded_cb); |
| 40 ~FakeVideoDecoder() override; | 40 ~FakeVideoDecoder() override; |
| 41 | 41 |
| 42 // Enables encrypted config supported. Must be called before Initialize(). |
| 43 void EnableEncryptedConfigSupport(); |
| 44 |
| 42 // VideoDecoder implementation. | 45 // VideoDecoder implementation. |
| 43 std::string GetDisplayName() const override; | 46 std::string GetDisplayName() const override; |
| 44 void Initialize(const VideoDecoderConfig& config, | 47 void Initialize(const VideoDecoderConfig& config, |
| 45 bool low_delay, | 48 bool low_delay, |
| 46 CdmContext* cdm_context, | 49 CdmContext* cdm_context, |
| 47 const InitCB& init_cb, | 50 const InitCB& init_cb, |
| 48 const OutputCB& output_cb) override; | 51 const OutputCB& output_cb) override; |
| 49 void Decode(const scoped_refptr<DecoderBuffer>& buffer, | 52 void Decode(const scoped_refptr<DecoderBuffer>& buffer, |
| 50 const DecodeCB& decode_cb) override; | 53 const DecodeCB& decode_cb) override; |
| 51 void Reset(const base::Closure& closure) override; | 54 void Reset(const base::Closure& closure) override; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 void RunDecodeCallback(const DecodeCB& decode_cb); | 95 void RunDecodeCallback(const DecodeCB& decode_cb); |
| 93 | 96 |
| 94 void DoReset(); | 97 void DoReset(); |
| 95 | 98 |
| 96 base::ThreadChecker thread_checker_; | 99 base::ThreadChecker thread_checker_; |
| 97 | 100 |
| 98 const size_t decoding_delay_; | 101 const size_t decoding_delay_; |
| 99 const int max_parallel_decoding_requests_; | 102 const int max_parallel_decoding_requests_; |
| 100 BytesDecodedCB bytes_decoded_cb_; | 103 BytesDecodedCB bytes_decoded_cb_; |
| 101 | 104 |
| 105 bool supports_encrypted_config_ = false; |
| 106 |
| 102 State state_; | 107 State state_; |
| 103 | 108 |
| 104 CallbackHolder<InitCB> init_cb_; | 109 CallbackHolder<InitCB> init_cb_; |
| 105 CallbackHolder<base::Closure> reset_cb_; | 110 CallbackHolder<base::Closure> reset_cb_; |
| 106 | 111 |
| 107 OutputCB output_cb_; | 112 OutputCB output_cb_; |
| 108 | 113 |
| 109 bool hold_decode_; | 114 bool hold_decode_; |
| 110 std::list<DecodeCB> held_decode_callbacks_; | 115 std::list<DecodeCB> held_decode_callbacks_; |
| 111 | 116 |
| 112 VideoDecoderConfig current_config_; | 117 VideoDecoderConfig current_config_; |
| 113 | 118 |
| 114 std::list<scoped_refptr<VideoFrame> > decoded_frames_; | 119 std::list<scoped_refptr<VideoFrame> > decoded_frames_; |
| 115 | 120 |
| 116 int total_bytes_decoded_; | 121 int total_bytes_decoded_; |
| 117 | 122 |
| 118 bool fail_to_initialize_; | 123 bool fail_to_initialize_; |
| 119 | 124 |
| 120 // NOTE: Weak pointers must be invalidated before all other member variables. | 125 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 121 base::WeakPtrFactory<FakeVideoDecoder> weak_factory_; | 126 base::WeakPtrFactory<FakeVideoDecoder> weak_factory_; |
| 122 | 127 |
| 123 DISALLOW_COPY_AND_ASSIGN(FakeVideoDecoder); | 128 DISALLOW_COPY_AND_ASSIGN(FakeVideoDecoder); |
| 124 }; | 129 }; |
| 125 | 130 |
| 126 } // namespace media | 131 } // namespace media |
| 127 | 132 |
| 128 #endif // MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_ | 133 #endif // MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_ |
| OLD | NEW |