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

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

Issue 65803002: Replace MessageLoopProxy with SingleThreadTaskRunner for media/filters/ + associated code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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
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_VIDEO_DECODER_H_ 5 #ifndef MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_
6 #define MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ 6 #define MEDIA_FILTERS_FFMPEG_VIDEO_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" 12 #include "base/memory/weak_ptr.h"
13 #include "media/base/video_decoder.h" 13 #include "media/base/video_decoder.h"
14 #include "media/base/video_decoder_config.h" 14 #include "media/base/video_decoder_config.h"
15 15
16 struct AVCodecContext; 16 struct AVCodecContext;
17 struct AVFrame; 17 struct AVFrame;
18 18
19 namespace base { 19 namespace base {
20 class MessageLoopProxy; 20 class SingleThreadTaskRunner;
21 } 21 }
22 22
23 namespace media { 23 namespace media {
24 24
25 class DecoderBuffer; 25 class DecoderBuffer;
26 class ScopedPtrAVFreeContext; 26 class ScopedPtrAVFreeContext;
27 class ScopedPtrAVFreeFrame; 27 class ScopedPtrAVFreeFrame;
28 28
29 class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder { 29 class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder {
30 public: 30 public:
31 explicit FFmpegVideoDecoder( 31 explicit FFmpegVideoDecoder(
32 const scoped_refptr<base::MessageLoopProxy>& message_loop); 32 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
33 virtual ~FFmpegVideoDecoder(); 33 virtual ~FFmpegVideoDecoder();
34 34
35 // VideoDecoder implementation. 35 // VideoDecoder implementation.
36 virtual void Initialize(const VideoDecoderConfig& config, 36 virtual void Initialize(const VideoDecoderConfig& config,
37 const PipelineStatusCB& status_cb) OVERRIDE; 37 const PipelineStatusCB& status_cb) OVERRIDE;
38 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, 38 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer,
39 const DecodeCB& decode_cb) OVERRIDE; 39 const DecodeCB& decode_cb) OVERRIDE;
40 virtual void Reset(const base::Closure& closure) OVERRIDE; 40 virtual void Reset(const base::Closure& closure) OVERRIDE;
41 virtual void Stop(const base::Closure& closure) OVERRIDE; 41 virtual void Stop(const base::Closure& closure) OVERRIDE;
42 42
(...skipping 20 matching lines...) Expand all
63 // Returns true if initialization was successful. 63 // Returns true if initialization was successful.
64 bool ConfigureDecoder(); 64 bool ConfigureDecoder();
65 65
66 // Releases resources associated with |codec_context_| and |av_frame_| 66 // Releases resources associated with |codec_context_| and |av_frame_|
67 // and resets them to NULL. 67 // and resets them to NULL.
68 void ReleaseFFmpegResources(); 68 void ReleaseFFmpegResources();
69 69
70 // Reset decoder and call |reset_cb_|. 70 // Reset decoder and call |reset_cb_|.
71 void DoReset(); 71 void DoReset();
72 72
73 scoped_refptr<base::MessageLoopProxy> message_loop_; 73 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
74 base::WeakPtrFactory<FFmpegVideoDecoder> weak_factory_; 74 base::WeakPtrFactory<FFmpegVideoDecoder> weak_factory_;
75 base::WeakPtr<FFmpegVideoDecoder> weak_this_; 75 base::WeakPtr<FFmpegVideoDecoder> weak_this_;
76 76
77 DecoderState state_; 77 DecoderState state_;
78 78
79 DecodeCB decode_cb_; 79 DecodeCB decode_cb_;
80 base::Closure reset_cb_; 80 base::Closure reset_cb_;
81 81
82 // FFmpeg structures owned by this object. 82 // FFmpeg structures owned by this object.
83 scoped_ptr_malloc<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; 83 scoped_ptr_malloc<AVCodecContext, ScopedPtrAVFreeContext> codec_context_;
84 scoped_ptr_malloc<AVFrame, ScopedPtrAVFreeFrame> av_frame_; 84 scoped_ptr_malloc<AVFrame, ScopedPtrAVFreeFrame> av_frame_;
85 85
86 VideoDecoderConfig config_; 86 VideoDecoderConfig config_;
87 87
88 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); 88 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder);
89 }; 89 };
90 90
91 } // namespace media 91 } // namespace media
92 92
93 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ 93 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698