| Index: media/filters/fake_video_decoder.h
|
| diff --git a/media/filters/fake_video_decoder.h b/media/filters/fake_video_decoder.h
|
| index 240203ff5b6c656e936cf2c44c28958f314da2b6..03ed111a5e93df2e87f055262f718cd9361de5f2 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.
|
| @@ -42,10 +45,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
|
| @@ -54,12 +58,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
|
| + STATE_UNINITIALIZED,
|
| + STATE_NORMAL,
|
| + STATE_END_OF_STREAM,
|
| + STATE_ERROR,
|
| };
|
|
|
| // Callback for updating |total_bytes_decoded_|.
|
| @@ -68,20 +79,29 @@ class FakeVideoDecoder : public VideoDecoder {
|
| Status status,
|
| const scoped_refptr<VideoFrame>& video_frame);
|
|
|
| - void DoReset();
|
| + // Runs |decode_cb| or puts it to |held_decode_callbacks_| depending on
|
| + // current value of |hold_decode_|.
|
| + void RunOrHoldDecode(const DecodeCB& decode_cb);
|
|
|
| - scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
|
| + // Runs |decode_cb| with a frame from |decoded_frames_|.
|
| + void RunDecodeCallback(const DecodeCB& decode_cb);
|
|
|
| - const int decoding_delay_;
|
| + void DoReset();
|
| +
|
| + base::ThreadChecker thread_checker_;
|
|
|
| - bool supports_get_decode_output_;
|
| + const size_t decoding_delay_;
|
| + 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_;
|
|
|