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

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

Issue 1469353010: Configure MediaCodec with CDM in ADVA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Passed needs_protected_surface to codec configuration, addressed comments Created 5 years 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_DECODE_ACCELERATOR_H_ 5 #ifndef CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_
6 #define CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ 6 #define CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <queue> 10 #include <queue>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
16 #include "base/timer/timer.h" 16 #include "base/timer/timer.h"
17 #include "content/common/content_export.h" 17 #include "content/common/content_export.h"
18 #include "content/common/gpu/media/avda_state_provider.h" 18 #include "content/common/gpu/media/avda_state_provider.h"
19 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 19 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
20 #include "media/base/android/media_codec_bridge.h" 20 #include "media/base/android/media_codec_bridge.h"
21 #include "media/base/android/media_drm_bridge.h"
22 #include "media/base/media_keys.h"
21 #include "media/video/video_decode_accelerator.h" 23 #include "media/video/video_decode_accelerator.h"
22 24
23 namespace gfx { 25 namespace gfx {
24 class SurfaceTexture; 26 class SurfaceTexture;
25 } 27 }
26 28
27 namespace content { 29 namespace content {
28 30
29 // A VideoDecodeAccelerator implementation for Android. 31 // A VideoDecodeAccelerator implementation for Android.
30 // This class decodes the input encoded stream by using Android's MediaCodec 32 // This class decodes the input encoded stream by using Android's MediaCodec
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 void QueueInput(); 142 void QueueInput();
141 143
142 // Dequeues output from |media_codec_| and feeds the decoded frame to the 144 // Dequeues output from |media_codec_| and feeds the decoded frame to the
143 // client. Returns a hint about whether calling again might produce 145 // client. Returns a hint about whether calling again might produce
144 // more output. 146 // more output.
145 bool DequeueOutput(); 147 bool DequeueOutput();
146 148
147 // Requests picture buffers from the client. 149 // Requests picture buffers from the client.
148 void RequestPictureBuffers(); 150 void RequestPictureBuffers();
149 151
152 // This callback is called after CDM obtained a MediaCrypto object.
153 void OnMediaCryptoReady(media::MediaDrmBridge::JavaObjectPtr media_crypto,
154 bool needs_protected_surface);
155
156 // This callback is called when a new key is added to CDM.
157 void OnKeyAdded();
158
150 // Notifies the client of the CDM setting result. 159 // Notifies the client of the CDM setting result.
151 void NotifyCdmAttached(bool success); 160 void NotifyCdmAttached(bool success);
152 161
153 // Notifies the client about the availability of a picture. 162 // Notifies the client about the availability of a picture.
154 void NotifyPictureReady(const media::Picture& picture); 163 void NotifyPictureReady(const media::Picture& picture);
155 164
156 // Notifies the client that the input buffer identifed by input_buffer_id has 165 // Notifies the client that the input buffer identifed by input_buffer_id has
157 // been processed. 166 // been processed.
158 void NotifyEndOfBitstreamBuffer(int input_buffer_id); 167 void NotifyEndOfBitstreamBuffer(int input_buffer_id);
159 168
(...skipping 14 matching lines...) Expand all
174 183
175 // Callback to set the correct gl context. 184 // Callback to set the correct gl context.
176 base::Callback<bool(void)> make_context_current_; 185 base::Callback<bool(void)> make_context_current_;
177 186
178 // Codec type. Used when we configure media codec. 187 // Codec type. Used when we configure media codec.
179 media::VideoCodec codec_; 188 media::VideoCodec codec_;
180 189
181 // Whether the stream is encrypted. 190 // Whether the stream is encrypted.
182 bool is_encrypted_; 191 bool is_encrypted_;
183 192
193 // Whether encryption scheme requires to use protected surface.
194 bool needs_protected_surface_;
195
184 // The current state of this class. For now, this is used only for setting 196 // The current state of this class. For now, this is used only for setting
185 // error state. 197 // error state.
186 State state_; 198 State state_;
187 199
188 // This map maintains the picture buffers passed to the client for decoding. 200 // This map maintains the picture buffers passed to the client for decoding.
189 // The key is the picture buffer id. 201 // The key is the picture buffer id.
190 OutputBufferMap output_picture_buffers_; 202 OutputBufferMap output_picture_buffers_;
191 203
192 // This keeps the free picture buffer ids which can be used for sending 204 // This keeps the free picture buffer ids which can be used for sending
193 // decoded frames to the client. 205 // decoded frames to the client.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 241
230 // Owner of the GL context. Used to restore the context state. 242 // Owner of the GL context. Used to restore the context state.
231 base::WeakPtr<gpu::gles2::GLES2Decoder> gl_decoder_; 243 base::WeakPtr<gpu::gles2::GLES2Decoder> gl_decoder_;
232 244
233 // Repeating timer responsible for draining pending IO to the codec. 245 // Repeating timer responsible for draining pending IO to the codec.
234 base::RepeatingTimer io_timer_; 246 base::RepeatingTimer io_timer_;
235 247
236 // Backing strategy that we'll use to connect PictureBuffers to frames. 248 // Backing strategy that we'll use to connect PictureBuffers to frames.
237 scoped_ptr<BackingStrategy> strategy_; 249 scoped_ptr<BackingStrategy> strategy_;
238 250
251 // CDM related stuff.
252
253 // Holds a ref-count to the CDM.
254 scoped_refptr<media::MediaKeys> cdm_;
255
256 // MediaDrmBridge requires registration/unregistration of the player, this
257 // registration id is used for this.
258 int cdm_registration_id_;
259
260 // The MediaCrypto object is used in the MediaCodec.configure() in case of
261 // an encrypted stream.
262 media::MediaDrmBridge::JavaObjectPtr media_crypto_;
263
239 // WeakPtrFactory for posting tasks back to |this|. 264 // WeakPtrFactory for posting tasks back to |this|.
240 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; 265 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_;
241 266
242 friend class AndroidVideoDecodeAcceleratorTest; 267 friend class AndroidVideoDecodeAcceleratorTest;
243 }; 268 };
244 269
245 } // namespace content 270 } // namespace content
246 271
247 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ 272 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698