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 16 matching lines...) Expand all Loading... |
27 | 27 |
28 namespace media { | 28 namespace media { |
29 | 29 |
30 typedef base::Callback<void(int)> BytesDecodedCB; | 30 typedef base::Callback<void(int)> BytesDecodedCB; |
31 | 31 |
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(const std::string& decoder_name, |
| 38 int decoding_delay, |
38 int max_parallel_decoding_requests, | 39 int max_parallel_decoding_requests, |
39 const BytesDecodedCB& bytes_decoded_cb); | 40 const BytesDecodedCB& bytes_decoded_cb); |
40 ~FakeVideoDecoder() override; | 41 ~FakeVideoDecoder() override; |
41 | 42 |
42 // Enables encrypted config supported. Must be called before Initialize(). | 43 // Enables encrypted config supported. Must be called before Initialize(). |
43 void EnableEncryptedConfigSupport(); | 44 void EnableEncryptedConfigSupport(); |
44 | 45 |
45 // VideoDecoder implementation. | 46 // VideoDecoder implementation. |
46 std::string GetDisplayName() const override; | 47 std::string GetDisplayName() const override; |
47 void Initialize(const VideoDecoderConfig& config, | 48 void Initialize(const VideoDecoderConfig& config, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // current value of |hold_decode_|. | 92 // current value of |hold_decode_|. |
92 void RunOrHoldDecode(const DecodeCB& decode_cb); | 93 void RunOrHoldDecode(const DecodeCB& decode_cb); |
93 | 94 |
94 // Runs |decode_cb| with a frame from |decoded_frames_|. | 95 // Runs |decode_cb| with a frame from |decoded_frames_|. |
95 void RunDecodeCallback(const DecodeCB& decode_cb); | 96 void RunDecodeCallback(const DecodeCB& decode_cb); |
96 | 97 |
97 void DoReset(); | 98 void DoReset(); |
98 | 99 |
99 base::ThreadChecker thread_checker_; | 100 base::ThreadChecker thread_checker_; |
100 | 101 |
| 102 const std::string decoder_name_; |
101 const size_t decoding_delay_; | 103 const size_t decoding_delay_; |
102 const int max_parallel_decoding_requests_; | 104 const int max_parallel_decoding_requests_; |
103 BytesDecodedCB bytes_decoded_cb_; | 105 BytesDecodedCB bytes_decoded_cb_; |
104 | 106 |
105 bool supports_encrypted_config_ = false; | 107 bool supports_encrypted_config_ = false; |
106 | 108 |
107 State state_; | 109 State state_; |
108 | 110 |
109 CallbackHolder<InitCB> init_cb_; | 111 CallbackHolder<InitCB> init_cb_; |
110 CallbackHolder<base::Closure> reset_cb_; | 112 CallbackHolder<base::Closure> reset_cb_; |
(...skipping 13 matching lines...) Expand all Loading... |
124 | 126 |
125 // NOTE: Weak pointers must be invalidated before all other member variables. | 127 // NOTE: Weak pointers must be invalidated before all other member variables. |
126 base::WeakPtrFactory<FakeVideoDecoder> weak_factory_; | 128 base::WeakPtrFactory<FakeVideoDecoder> weak_factory_; |
127 | 129 |
128 DISALLOW_COPY_AND_ASSIGN(FakeVideoDecoder); | 130 DISALLOW_COPY_AND_ASSIGN(FakeVideoDecoder); |
129 }; | 131 }; |
130 | 132 |
131 } // namespace media | 133 } // namespace media |
132 | 134 |
133 #endif // MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_ | 135 #endif // MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_ |
OLD | NEW |