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

Side by Side Diff: media/filters/ffmpeg_audio_decoder.h

Issue 193303002: WeakPtr destruction order cleanup: media edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/filters/fake_video_decoder.cc ('k') | media/filters/ffmpeg_audio_decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ 5 #ifndef MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_
6 #define MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ 6 #define MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h"
13 #include "base/time/time.h" 12 #include "base/time/time.h"
14 #include "media/base/audio_decoder.h" 13 #include "media/base/audio_decoder.h"
15 #include "media/base/demuxer_stream.h" 14 #include "media/base/demuxer_stream.h"
16 #include "media/base/sample_format.h" 15 #include "media/base/sample_format.h"
17 #include "media/ffmpeg/ffmpeg_deleters.h" 16 #include "media/ffmpeg/ffmpeg_deleters.h"
18 17
19 struct AVCodecContext; 18 struct AVCodecContext;
20 struct AVFrame; 19 struct AVFrame;
21 20
22 namespace base { 21 namespace base {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // Handles (re-)initializing the decoder with a (new) config. 65 // Handles (re-)initializing the decoder with a (new) config.
67 // Returns true if initialization was successful. 66 // Returns true if initialization was successful.
68 bool ConfigureDecoder(); 67 bool ConfigureDecoder();
69 68
70 // Releases resources associated with |codec_context_| and |av_frame_| 69 // Releases resources associated with |codec_context_| and |av_frame_|
71 // and resets them to NULL. 70 // and resets them to NULL.
72 void ReleaseFFmpegResources(); 71 void ReleaseFFmpegResources();
73 void ResetTimestampState(); 72 void ResetTimestampState();
74 73
75 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 74 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
76 base::WeakPtrFactory<FFmpegAudioDecoder> weak_factory_;
77 base::WeakPtr<FFmpegAudioDecoder> weak_this_;
78 75
79 DecoderState state_; 76 DecoderState state_;
80 77
81 // FFmpeg structures owned by this object. 78 // FFmpeg structures owned by this object.
82 scoped_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; 79 scoped_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_;
83 scoped_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_; 80 scoped_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_;
84 81
85 // Decoded audio format. 82 // Decoded audio format.
86 int bytes_per_channel_; 83 int bytes_per_channel_;
87 ChannelLayout channel_layout_; 84 ChannelLayout channel_layout_;
(...skipping 16 matching lines...) Expand all
104 // Since multiple frames may be decoded from the same packet we need to queue 101 // Since multiple frames may be decoded from the same packet we need to queue
105 // them up. 102 // them up.
106 std::list<scoped_refptr<AudioBuffer> > queued_audio_; 103 std::list<scoped_refptr<AudioBuffer> > queued_audio_;
107 104
108 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder); 105 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder);
109 }; 106 };
110 107
111 } // namespace media 108 } // namespace media
112 109
113 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ 110 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_
OLDNEW
« no previous file with comments | « media/filters/fake_video_decoder.cc ('k') | media/filters/ffmpeg_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698