Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Unified Diff: media/filters/fake_video_decoder.h

Issue 239893002: Allow multiple concurrent Decode() requests in VideoDecoder interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/fake_demuxer_stream.cc ('k') | media/filters/fake_video_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « media/filters/fake_demuxer_stream.cc ('k') | media/filters/fake_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698