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

Unified Diff: media/filters/video_renderer_base.h

Issue 12989009: Remove reference counting from media::VideoDecoder and friends. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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/video_renderer_base.h
diff --git a/media/filters/video_renderer_base.h b/media/filters/video_renderer_base.h
index 8fb6182bcb4437ae6382fb625d426383d3429034..505a35e115122b23d9ed20398f54afe95b5a8291 100644
--- a/media/filters/video_renderer_base.h
+++ b/media/filters/video_renderer_base.h
@@ -8,6 +8,7 @@
#include <deque>
#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_vector.h"
#include "base/memory/weak_ptr.h"
#include "base/synchronization/condition_variable.h"
#include "base/synchronization/lock.h"
@@ -42,6 +43,8 @@ class MEDIA_EXPORT VideoRendererBase
// Maximum duration of the last frame.
static base::TimeDelta kMaxLastFrameDuration();
+ // |decoders| contains the VideoDecoders to use when initializing.
+ //
// |paint_cb| is executed on the video frame timing thread whenever a new
// frame is available for painting.
//
@@ -54,6 +57,7 @@ class MEDIA_EXPORT VideoRendererBase
//
// Setting |drop_frames_| to true causes the renderer to drop expired frames.
VideoRendererBase(const scoped_refptr<base::MessageLoopProxy>& message_loop,
+ ScopedVector<VideoDecoder> decoders,
const SetDecryptorReadyCB& set_decryptor_ready_cb,
const PaintCB& paint_cb,
const SetOpaqueCB& set_opaque_cb,
@@ -62,7 +66,6 @@ class MEDIA_EXPORT VideoRendererBase
// VideoRenderer implementation.
virtual void Initialize(const scoped_refptr<DemuxerStream>& stream,
- const VideoDecoderList& decoders,
const PipelineStatusCB& init_cb,
const StatisticsCB& statistics_cb,
const TimeCB& max_time_cb,
@@ -83,14 +86,13 @@ class MEDIA_EXPORT VideoRendererBase
virtual void ThreadMain() OVERRIDE;
private:
- // Called when |decoder_selector_| selected the |selected_decoder|.
- // |decrypting_demuxer_stream| was also populated if a DecryptingDemuxerStream
+ // Called when |decoder_selector_| has selected |decoder| or is null if no
+ // decoder could be selected.
+ //
+ // |decrypting_demuxer_stream| is non-null if a DecryptingDemuxerStream was
// created to help decrypt the encrypted stream.
- // Note: |decoder_selector| is passed here to keep the VideoDecoderSelector
- // alive until OnDecoderSelected() finishes.
void OnDecoderSelected(
- scoped_ptr<VideoDecoderSelector> decoder_selector,
- const scoped_refptr<VideoDecoder>& selected_decoder,
+ scoped_ptr<VideoDecoder> decoder,
const scoped_refptr<DecryptingDemuxerStream>& decrypting_demuxer_stream);
// Callback from the video decoder delivering decoded video frames and
@@ -138,31 +140,19 @@ class MEDIA_EXPORT VideoRendererBase
void ResetDecoder();
void StopDecoder(const base::Closure& callback);
- // Pops the front of |decoders|, assigns it to |decoder_| and then
- // calls initialize on the new decoder.
- void InitializeNextDecoder(const scoped_refptr<DemuxerStream>& demuxer_stream,
- scoped_ptr<VideoDecoderList> decoders);
-
- // Called when |decoder_| initialization completes.
- // |demuxer_stream| & |decoders| are used if initialization failed and
- // InitializeNextDecoder() needs to be called again.
- void OnDecoderInitDone(const scoped_refptr<DemuxerStream>& demuxer_stream,
- scoped_ptr<VideoDecoderList> decoders,
- PipelineStatus status);
-
void TransitionToPrerolled_Locked();
scoped_refptr<base::MessageLoopProxy> message_loop_;
base::WeakPtrFactory<VideoRendererBase> weak_factory_;
base::WeakPtr<VideoRendererBase> weak_this_;
+ scoped_ptr<VideoDecoderSelector> decoder_selector_;
+
// Used for accessing data members.
base::Lock lock_;
- SetDecryptorReadyCB set_decryptor_ready_cb_;
-
// These two will be set by VideoDecoderSelector::SelectVideoDecoder().
- scoped_refptr<VideoDecoder> decoder_;
+ scoped_ptr<VideoDecoder> decoder_;
scoped_refptr<DecryptingDemuxerStream> decrypting_demuxer_stream_;
// Queue of incoming frames yet to be painted.

Powered by Google App Engine
This is Rietveld 408576698