| OLD | NEW |
| 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 MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 5 #ifndef MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
| 6 #define MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 6 #define MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "media/base/android/media_drm_bridge_cdm_context.h" | 21 #include "media/base/android/media_drm_bridge_cdm_context.h" |
| 22 #include "media/base/android/sdk_media_codec_bridge.h" | 22 #include "media/base/android/sdk_media_codec_bridge.h" |
| 23 #include "media/base/content_decryption_module.h" | 23 #include "media/base/content_decryption_module.h" |
| 24 #include "media/gpu/avda_codec_allocator.h" | 24 #include "media/gpu/avda_codec_allocator.h" |
| 25 #include "media/gpu/avda_picture_buffer_manager.h" | 25 #include "media/gpu/avda_picture_buffer_manager.h" |
| 26 #include "media/gpu/avda_state_provider.h" | 26 #include "media/gpu/avda_state_provider.h" |
| 27 #include "media/gpu/gpu_video_decode_accelerator_helpers.h" | 27 #include "media/gpu/gpu_video_decode_accelerator_helpers.h" |
| 28 #include "media/gpu/media_gpu_export.h" | 28 #include "media/gpu/media_gpu_export.h" |
| 29 #include "media/video/video_decode_accelerator.h" | 29 #include "media/video/video_decode_accelerator.h" |
| 30 #include "ui/gl/android/scoped_java_surface.h" | 30 #include "ui/gl/android/scoped_java_surface.h" |
| 31 #include "ui/gl/android/surface_texture.h" |
| 31 | 32 |
| 32 namespace media { | 33 namespace media { |
| 33 class SharedMemoryRegion; | 34 class SharedMemoryRegion; |
| 34 | 35 |
| 35 // A VideoDecodeAccelerator implementation for Android. This class decodes the | 36 // A VideoDecodeAccelerator implementation for Android. This class decodes the |
| 36 // encded input stream using Android's MediaCodec. It handles the work of | 37 // encded input stream using Android's MediaCodec. It handles the work of |
| 37 // transferring data to and from MediaCodec, and delegates attaching MediaCodec | 38 // transferring data to and from MediaCodec, and delegates attaching MediaCodec |
| 38 // output buffers to PictureBuffers to AVDAPictureBufferManager. | 39 // output buffers to PictureBuffers to AVDAPictureBufferManager. |
| 39 class MEDIA_GPU_EXPORT AndroidVideoDecodeAccelerator | 40 class MEDIA_GPU_EXPORT AndroidVideoDecodeAccelerator |
| 40 : public VideoDecodeAccelerator, | 41 : public VideoDecodeAccelerator, |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 // Indicates if MediaCodec should not be used for software decoding since we | 209 // Indicates if MediaCodec should not be used for software decoding since we |
| 209 // have safer versions elsewhere. | 210 // have safer versions elsewhere. |
| 210 bool IsMediaCodecSoftwareDecodingForbidden() const; | 211 bool IsMediaCodecSoftwareDecodingForbidden() const; |
| 211 | 212 |
| 212 // On platforms which support seamless surface changes, this will reinitialize | 213 // On platforms which support seamless surface changes, this will reinitialize |
| 213 // the picture buffer manager with the new surface. This function reads and | 214 // the picture buffer manager with the new surface. This function reads and |
| 214 // clears the surface id from |pending_surface_id_|. It will issue a decode | 215 // clears the surface id from |pending_surface_id_|. It will issue a decode |
| 215 // error if the surface change fails. Returns false on failure. | 216 // error if the surface change fails. Returns false on failure. |
| 216 bool UpdateSurface(); | 217 bool UpdateSurface(); |
| 217 | 218 |
| 219 // Release |media_codec_| if it's not null, and notify |
| 220 // |picture_buffer_manager_|. |
| 221 void ReleaseCodec(); |
| 222 |
| 218 // Used to DCHECK that we are called on the correct thread. | 223 // Used to DCHECK that we are called on the correct thread. |
| 219 base::ThreadChecker thread_checker_; | 224 base::ThreadChecker thread_checker_; |
| 220 | 225 |
| 221 // To expose client callbacks from VideoDecodeAccelerator. | 226 // To expose client callbacks from VideoDecodeAccelerator. |
| 222 Client* client_; | 227 Client* client_; |
| 223 | 228 |
| 224 // Callback to set the correct gl context. | 229 // Callback to set the correct gl context. |
| 225 MakeGLContextCurrentCallback make_context_current_cb_; | 230 MakeGLContextCurrentCallback make_context_current_cb_; |
| 226 | 231 |
| 227 // Callback to get the GLES2Decoder instance. | 232 // Callback to get the GLES2Decoder instance. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 | 320 |
| 316 // True if surface creation and |picture_buffer_manager_| initialization has | 321 // True if surface creation and |picture_buffer_manager_| initialization has |
| 317 // been defered until the first Decode() call. | 322 // been defered until the first Decode() call. |
| 318 bool defer_surface_creation_; | 323 bool defer_surface_creation_; |
| 319 | 324 |
| 320 // Has a value if a SetSurface() call has occurred and a new surface should be | 325 // Has a value if a SetSurface() call has occurred and a new surface should be |
| 321 // switched to when possible. Cleared during OnSurfaceDestroyed() and if all | 326 // switched to when possible. Cleared during OnSurfaceDestroyed() and if all |
| 322 // pictures have been rendered in DequeueOutput(). | 327 // pictures have been rendered in DequeueOutput(). |
| 323 base::Optional<int32_t> pending_surface_id_; | 328 base::Optional<int32_t> pending_surface_id_; |
| 324 | 329 |
| 330 // The task type used for the last codec release. For posting SurfaceTexture |
| 331 // release to the same thread. |
| 332 TaskType last_release_task_type_; |
| 333 |
| 325 // Copy of the VDA::Config we were given. | 334 // Copy of the VDA::Config we were given. |
| 326 Config config_; | 335 Config config_; |
| 327 | 336 |
| 328 // WeakPtrFactory for posting tasks back to |this|. | 337 // WeakPtrFactory for posting tasks back to |this|. |
| 329 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; | 338 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; |
| 330 | 339 |
| 331 friend class AndroidVideoDecodeAcceleratorTest; | 340 friend class AndroidVideoDecodeAcceleratorTest; |
| 332 }; | 341 }; |
| 333 | 342 |
| 334 } // namespace media | 343 } // namespace media |
| 335 | 344 |
| 336 #endif // MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 345 #endif // MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |