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

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
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_;

Powered by Google App Engine
This is Rietveld 408576698