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

Unified Diff: media/filters/ffmpeg_demuxer.h

Issue 13813016: Remove reference counting from media::Demuxer and friends. (Closed) Base URL: http://git.chromium.org/chromium/src.git@vd_scoped
Patch Set: Created 7 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/ffmpeg_demuxer.h
diff --git a/media/filters/ffmpeg_demuxer.h b/media/filters/ffmpeg_demuxer.h
index 87085c7270b684232504be2895740ef87f8ee44e..4e1a47e988aa8e2e5bd47a2f25698dadfba50fc9 100644
--- a/media/filters/ffmpeg_demuxer.h
+++ b/media/filters/ffmpeg_demuxer.h
@@ -27,6 +27,7 @@
#include "base/callback.h"
#include "base/gtest_prod_util.h"
+#include "base/memory/scoped_vector.h"
#include "base/threading/thread.h"
#include "media/base/audio_decoder_config.h"
#include "media/base/decoder_buffer.h"
@@ -63,6 +64,7 @@ class FFmpegDemuxerStream : public DemuxerStream {
// Keeps a copy of |demuxer| and initializes itself using information
// inside |stream|. Both parameters must outlive |this|.
FFmpegDemuxerStream(FFmpegDemuxer* demuxer, AVStream* stream);
+ virtual ~FFmpegDemuxerStream();
// Enqueues the given AVPacket. It is invalid to queue a |packet| after
// SetEndOfStream() has been called.
@@ -98,9 +100,6 @@ class FFmpegDemuxerStream : public DemuxerStream {
// Returns true if this stream has capacity for additional data.
bool HasAvailableCapacity();
- protected:
- virtual ~FFmpegDemuxerStream();
-
private:
friend class FFmpegDemuxerTest;
@@ -140,6 +139,7 @@ class MEDIA_EXPORT FFmpegDemuxer : public Demuxer {
FFmpegDemuxer(const scoped_refptr<base::MessageLoopProxy>& message_loop,
const scoped_refptr<DataSource>& data_source,
const FFmpegNeedKeyCB& need_key_cb);
+ virtual ~FFmpegDemuxer();
// Demuxer implementation.
virtual void Initialize(DemuxerHost* host,
@@ -148,8 +148,7 @@ class MEDIA_EXPORT FFmpegDemuxer : public Demuxer {
virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE;
virtual void OnAudioRendererDisabled() OVERRIDE;
virtual void SetPlaybackRate(float playback_rate) OVERRIDE;
- virtual scoped_refptr<DemuxerStream> GetStream(
- DemuxerStream::Type type) OVERRIDE;
+ virtual DemuxerStream* GetStream(DemuxerStream::Type type) OVERRIDE;
virtual base::TimeDelta GetStartTime() const OVERRIDE;
// Calls |need_key_cb_| with the initialization data encountered in the file.
@@ -165,8 +164,6 @@ class MEDIA_EXPORT FFmpegDemuxer : public Demuxer {
// To allow tests access to privates.
friend class FFmpegDemuxerTest;
- virtual ~FFmpegDemuxer();
-
// FFmpeg callbacks during initialization.
void OnOpenContextDone(const PipelineStatusCB& status_cb, bool result);
void OnFindStreamInfoDone(const PipelineStatusCB& status_cb, int result);
@@ -193,12 +190,13 @@ class MEDIA_EXPORT FFmpegDemuxer : public Demuxer {
// Returns the stream from |streams_| that matches |type| as an
// FFmpegDemuxerStream.
- scoped_refptr<FFmpegDemuxerStream> GetFFmpegStream(
- DemuxerStream::Type type) const;
+ FFmpegDemuxerStream* GetFFmpegStream(DemuxerStream::Type type) const;
DemuxerHost* host_;
scoped_refptr<base::MessageLoopProxy> message_loop_;
+ base::WeakPtrFactory<FFmpegDemuxer> weak_factory_;
+ base::WeakPtr<FFmpegDemuxer> weak_this_;
// Thread on which all blocking FFmpeg operations are executed.
base::Thread blocking_thread_;
@@ -222,7 +220,7 @@ class MEDIA_EXPORT FFmpegDemuxer : public Demuxer {
//
// Once initialized, operations on FFmpegDemuxerStreams should be carried out
// on the demuxer thread.
- typedef std::vector<scoped_refptr<FFmpegDemuxerStream> > StreamVector;
+ typedef ScopedVector<FFmpegDemuxerStream> StreamVector;
StreamVector streams_;
// Reference to the data source. Asynchronous read requests are submitted to

Powered by Google App Engine
This is Rietveld 408576698