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

Side by Side Diff: content/common/gpu/media/android_video_encode_accelerator.h

Issue 170843004: Pass Client pointer in Initialize() for VDA/VEA (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 50e826de 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_ 5 #ifndef CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_
6 #define CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_ 6 #define CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_
7 7
8 #include <list> 8 #include <list>
9 #include <queue> 9 #include <queue>
10 #include <vector> 10 #include <vector>
(...skipping 13 matching lines...) Expand all
24 namespace content { 24 namespace content {
25 25
26 // Android-specific implementation of media::VideoEncodeAccelerator, enabling 26 // Android-specific implementation of media::VideoEncodeAccelerator, enabling
27 // hardware-acceleration of video encoding, based on Android's MediaCodec class 27 // hardware-acceleration of video encoding, based on Android's MediaCodec class
28 // (http://developer.android.com/reference/android/media/MediaCodec.html). This 28 // (http://developer.android.com/reference/android/media/MediaCodec.html). This
29 // class expects to live and be called on a single thread (the GPU process' 29 // class expects to live and be called on a single thread (the GPU process'
30 // ChildThread). 30 // ChildThread).
31 class CONTENT_EXPORT AndroidVideoEncodeAccelerator 31 class CONTENT_EXPORT AndroidVideoEncodeAccelerator
32 : public media::VideoEncodeAccelerator { 32 : public media::VideoEncodeAccelerator {
33 public: 33 public:
34 explicit AndroidVideoEncodeAccelerator( 34 AndroidVideoEncodeAccelerator();
35 media::VideoEncodeAccelerator::Client* client);
36 virtual ~AndroidVideoEncodeAccelerator(); 35 virtual ~AndroidVideoEncodeAccelerator();
37 36
38 static std::vector<media::VideoEncodeAccelerator::SupportedProfile> 37 static std::vector<media::VideoEncodeAccelerator::SupportedProfile>
39 GetSupportedProfiles(); 38 GetSupportedProfiles();
40 39
41 // media::VideoEncodeAccelerator implementation. 40 // media::VideoEncodeAccelerator implementation.
42 virtual void Initialize(media::VideoFrame::Format format, 41 virtual void Initialize(media::VideoFrame::Format format,
43 const gfx::Size& input_visible_size, 42 const gfx::Size& input_visible_size,
44 media::VideoCodecProfile output_profile, 43 media::VideoCodecProfile output_profile,
45 uint32 initial_bitrate) OVERRIDE; 44 uint32 initial_bitrate,
45 Client* client) OVERRIDE;
46 virtual void Encode(const scoped_refptr<media::VideoFrame>& frame, 46 virtual void Encode(const scoped_refptr<media::VideoFrame>& frame,
47 bool force_keyframe) OVERRIDE; 47 bool force_keyframe) OVERRIDE;
48 virtual void UseOutputBitstreamBuffer(const media::BitstreamBuffer& buffer) 48 virtual void UseOutputBitstreamBuffer(const media::BitstreamBuffer& buffer)
49 OVERRIDE; 49 OVERRIDE;
50 virtual void RequestEncodingParametersChange(uint32 bitrate, 50 virtual void RequestEncodingParametersChange(uint32 bitrate,
51 uint32 framerate) OVERRIDE; 51 uint32 framerate) OVERRIDE;
52 virtual void Destroy() OVERRIDE; 52 virtual void Destroy() OVERRIDE;
53 53
54 private: 54 private:
55 enum { 55 enum {
(...skipping 14 matching lines...) Expand all
70 70
71 // Start & stop |io_timer_| if the time seems right. 71 // Start & stop |io_timer_| if the time seems right.
72 void MaybeStartIOTimer(); 72 void MaybeStartIOTimer();
73 void MaybeStopIOTimer(); 73 void MaybeStopIOTimer();
74 74
75 // Used to DCHECK that we are called on the correct thread. 75 // Used to DCHECK that we are called on the correct thread.
76 base::ThreadChecker thread_checker_; 76 base::ThreadChecker thread_checker_;
77 77
78 // VideoDecodeAccelerator::Client callbacks go here. Invalidated once any 78 // VideoDecodeAccelerator::Client callbacks go here. Invalidated once any
79 // error triggers. 79 // error triggers.
80 base::WeakPtrFactory<Client> client_ptr_factory_; 80 scoped_ptr<base::WeakPtrFactory<Client> > client_ptr_factory_;
81 81
82 scoped_ptr<media::VideoCodecBridge> media_codec_; 82 scoped_ptr<media::VideoCodecBridge> media_codec_;
83 83
84 // Bitstream buffers waiting to be populated & returned to the client. 84 // Bitstream buffers waiting to be populated & returned to the client.
85 std::vector<media::BitstreamBuffer> available_bitstream_buffers_; 85 std::vector<media::BitstreamBuffer> available_bitstream_buffers_;
86 86
87 // Frames waiting to be passed to the codec, queued until an input buffer is 87 // Frames waiting to be passed to the codec, queued until an input buffer is
88 // available. Each element is a tuple of <Frame, key_frame, enqueue_time>. 88 // available. Each element is a tuple of <Frame, key_frame, enqueue_time>.
89 typedef std::queue< 89 typedef std::queue<
90 Tuple3<scoped_refptr<media::VideoFrame>, bool, base::Time> > 90 Tuple3<scoped_refptr<media::VideoFrame>, bool, base::Time> >
(...skipping 15 matching lines...) Expand all
106 size_t output_buffers_capacity_; // 0 until RequireBitstreamBuffers. 106 size_t output_buffers_capacity_; // 0 until RequireBitstreamBuffers.
107 107
108 uint32 last_set_bitrate_; // In bps. 108 uint32 last_set_bitrate_; // In bps.
109 109
110 DISALLOW_COPY_AND_ASSIGN(AndroidVideoEncodeAccelerator); 110 DISALLOW_COPY_AND_ASSIGN(AndroidVideoEncodeAccelerator);
111 }; 111 };
112 112
113 } // namespace content 113 } // namespace content
114 114
115 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_ 115 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698