| Index: media/filters/fake_video_decoder.h
|
| diff --git a/media/filters/fake_video_decoder.h b/media/filters/fake_video_decoder.h
|
| index 8e6c2ecdd09230d5e3188af1b717ac51538f2a55..39315dc2353b7cb505927849c0717132104f94f4 100644
|
| --- a/media/filters/fake_video_decoder.h
|
| +++ b/media/filters/fake_video_decoder.h
|
| @@ -11,6 +11,7 @@
|
| #include "base/callback.h"
|
| #include "base/callback_helpers.h"
|
| #include "base/memory/weak_ptr.h"
|
| +#include "base/threading/thread_checker.h"
|
| #include "media/base/callback_holder.h"
|
| #include "media/base/decoder_buffer.h"
|
| #include "media/base/pipeline_status.h"
|
| @@ -30,7 +31,9 @@ namespace media {
|
| class FakeVideoDecoder : public VideoDecoder {
|
| public:
|
| // Constructs an object with a decoding delay of |decoding_delay| frames.
|
| - FakeVideoDecoder(int decoding_delay, bool supports_get_decode_output);
|
| + FakeVideoDecoder(int decoding_delay,
|
| + bool supports_get_decode_output,
|
| + int max_parallel_decoding_requests);
|
| virtual ~FakeVideoDecoder();
|
|
|
| // VideoDecoder implementation.
|
| @@ -41,10 +44,11 @@ class FakeVideoDecoder : public VideoDecoder {
|
| virtual void Reset(const base::Closure& closure) OVERRIDE;
|
| virtual void Stop() OVERRIDE;
|
| virtual scoped_refptr<VideoFrame> GetDecodeOutput() OVERRIDE;
|
| + virtual int GetMaxDecodeRequests() const OVERRIDE;
|
|
|
| // Holds the next init/decode/reset callback from firing.
|
| void HoldNextInit();
|
| - void HoldNextDecode();
|
| + void HoldDecode();
|
| void HoldNextReset();
|
|
|
| // Satisfies the pending init/decode/reset callback, which must be ready to
|
| @@ -53,12 +57,19 @@ class FakeVideoDecoder : public VideoDecoder {
|
| void SatisfyDecode();
|
| void SatisfyReset();
|
|
|
| + // Satisfies single decode request.
|
| + void SatisfySingleDecode();
|
| +
|
| + void SimulateError();
|
| +
|
| int total_bytes_decoded() const { return total_bytes_decoded_; }
|
|
|
| private:
|
| enum State {
|
| UNINITIALIZED,
|
| - NORMAL
|
| + NORMAL,
|
| + END_OF_STREAM,
|
| + ERROR,
|
| };
|
|
|
| // Callback for updating |total_bytes_decoded_|.
|
| @@ -67,20 +78,29 @@ class FakeVideoDecoder : public VideoDecoder {
|
| Status status,
|
| const scoped_refptr<VideoFrame>& video_frame);
|
|
|
| + // Runs |decode_cb| or puts it to |held_decode_callbacks_| depending on
|
| + // current value of |hold_decode_|.
|
| + void RunOrHoldDecode(const DecodeCB& decode_cb);
|
| +
|
| + // Runs |decode_cb| with a frame from |decoded_frames_|.
|
| + void RunDecodeCallback(const DecodeCB& decode_cb);
|
| +
|
| void DoReset();
|
|
|
| - scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
|
| + base::ThreadChecker thread_checker_;
|
|
|
| const int decoding_delay_;
|
| -
|
| - bool supports_get_decode_output_;
|
| + const bool supports_get_decode_output_;
|
| + const int max_parallel_decoding_requests_;
|
|
|
| State state_;
|
|
|
| CallbackHolder<PipelineStatusCB> init_cb_;
|
| - CallbackHolder<DecodeCB> decode_cb_;
|
| CallbackHolder<base::Closure> reset_cb_;
|
|
|
| + bool hold_decode_;
|
| + std::list<DecodeCB> held_decode_callbacks_;
|
| +
|
| VideoDecoderConfig current_config_;
|
|
|
| std::list<scoped_refptr<VideoFrame> > decoded_frames_;
|
|
|