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

Unified Diff: media/filters/ffmpeg_video_decoder.h

Issue 8417019: Simplify VideoDecodeEngine interface by making everything synchronous. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: recycling: vanquished Created 9 years, 2 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/ffmpeg_video_decoder.h
diff --git a/media/filters/ffmpeg_video_decoder.h b/media/filters/ffmpeg_video_decoder.h
index 5e1ba1ad1b4601cc20f09b0ad7431c187c4ab9ea..c030cdc7d6dc17e22d477406d4dc1710b8ca46e6 100644
--- a/media/filters/ffmpeg_video_decoder.h
+++ b/media/filters/ffmpeg_video_decoder.h
@@ -7,9 +7,9 @@
#include <deque>
+#include "base/memory/scoped_ptr.h"
#include "media/base/filters.h"
#include "media/base/pts_stream.h"
-#include "media/video/video_decode_engine.h"
#include "ui/gfx/size.h"
class MessageLoop;
@@ -18,9 +18,7 @@ namespace media {
class VideoDecodeEngine;
-class MEDIA_EXPORT FFmpegVideoDecoder
- : public VideoDecoder,
- public VideoDecodeEngine::EventHandler {
+class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder {
public:
explicit FFmpegVideoDecoder(MessageLoop* message_loop);
virtual ~FFmpegVideoDecoder();
@@ -35,62 +33,35 @@ class MEDIA_EXPORT FFmpegVideoDecoder
virtual void Initialize(DemuxerStream* demuxer_stream,
const base::Closure& callback,
const StatisticsCallback& stats_callback) OVERRIDE;
- virtual void ProduceVideoFrame(
- scoped_refptr<VideoFrame> video_frame) OVERRIDE;
+ virtual void Read(const FrameReadyCB& callback); OVERRIDE;
Ami GONE FROM CHROMIUM 2011/11/01 22:17:40 This is part of some other CL, right? Note that f
scherkus (not reviewing) 2011/11/03 04:55:59 Not sure what you mean -- this is replacing Produc
Ami GONE FROM CHROMIUM 2011/11/03 16:40:00 Now I'm not sure what I meant, either. nm.
virtual gfx::Size natural_size() OVERRIDE;
private:
- // VideoDecodeEngine::EventHandler interface.
- virtual void OnInitializeComplete(bool success) OVERRIDE;
- virtual void OnUninitializeComplete() OVERRIDE;
- virtual void OnFlushComplete() OVERRIDE;
- virtual void OnSeekComplete() OVERRIDE;
- virtual void OnError() OVERRIDE;
- virtual void ProduceVideoSample(scoped_refptr<Buffer> buffer) OVERRIDE;
- virtual void ConsumeVideoFrame(
- scoped_refptr<VideoFrame> frame,
- const PipelineStatistics& statistics) OVERRIDE;
-
enum DecoderState {
- kUnInitialized,
- kInitializing,
+ kUninitialized,
kNormal,
kFlushCodec,
kDecodeFinished,
- kPausing,
- kFlushing,
- kStopped
};
- void OnFlushComplete(const base::Closure& callback);
- void OnSeekComplete(const base::Closure& callback);
- void OnReadComplete(Buffer* buffer);
-
- // TODO(jiesun): until demuxer pass scoped_refptr<Buffer>: we could not merge
- // this with OnReadComplete
- void OnReadCompleteTask(scoped_refptr<Buffer> buffer);
+ void DoDecodeBuffer(const scoped_refptr<Buffer>& buffer);
- // Flush the output buffers that we had held in Paused state.
- void FlushBuffers();
+ // Reads from the demuxer stream with corresponding callback method.
+ void ReadFromDemuxerStream();
+ void DecodeBuffer(Buffer* buffer);
- // Injection point for unittest to provide a mock engine. Takes ownership of
- // the provided engine.
- virtual void SetVideoDecodeEngineForTest(VideoDecodeEngine* engine);
+ // Delivers the frame to |frame_ready_cb_| and resets the callback.
+ void DeliverFrame(const scoped_refptr<VideoFrame>& video_frame);
MessageLoop* message_loop_;
- PtsStream pts_stream_; // Stream of presentation timestamps.
+ PtsStream pts_stream_;
DecoderState state_;
scoped_ptr<VideoDecodeEngine> decode_engine_;
- base::Closure initialize_callback_;
- base::Closure uninitialize_callback_;
- base::Closure flush_callback_;
- FilterStatusCB seek_cb_;
StatisticsCallback statistics_callback_;
- // Hold video frames when flush happens.
- std::deque<scoped_refptr<VideoFrame> > frame_queue_flushed_;
+ FrameReadyCB frame_ready_cb_;
// TODO(scherkus): I think this should be calculated by VideoRenderers based
// on information provided by VideoDecoders (i.e., aspect ratio).

Powered by Google App Engine
This is Rietveld 408576698