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> |
11 #include <map> | 11 #include <map> |
12 #include <queue> | 12 #include <queue> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/optional.h" |
16 #include "base/threading/thread_checker.h" | 17 #include "base/threading/thread_checker.h" |
17 #include "base/timer/timer.h" | 18 #include "base/timer/timer.h" |
18 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 19 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
19 #include "gpu/command_buffer/service/gpu_preferences.h" | 20 #include "gpu/command_buffer/service/gpu_preferences.h" |
20 #include "media/base/android/media_drm_bridge_cdm_context.h" | 21 #include "media/base/android/media_drm_bridge_cdm_context.h" |
21 #include "media/base/android/sdk_media_codec_bridge.h" | 22 #include "media/base/android/sdk_media_codec_bridge.h" |
22 #include "media/base/media_keys.h" | 23 #include "media/base/media_keys.h" |
23 #include "media/gpu/avda_codec_allocator.h" | 24 #include "media/gpu/avda_codec_allocator.h" |
24 #include "media/gpu/avda_picture_buffer_manager.h" | 25 #include "media/gpu/avda_picture_buffer_manager.h" |
25 #include "media/gpu/avda_state_provider.h" | 26 #include "media/gpu/avda_state_provider.h" |
(...skipping 24 matching lines...) Expand all Loading... |
50 | 51 |
51 ~AndroidVideoDecodeAccelerator() override; | 52 ~AndroidVideoDecodeAccelerator() override; |
52 | 53 |
53 // VideoDecodeAccelerator implementation: | 54 // VideoDecodeAccelerator implementation: |
54 bool Initialize(const Config& config, Client* client) override; | 55 bool Initialize(const Config& config, Client* client) override; |
55 void Decode(const BitstreamBuffer& bitstream_buffer) override; | 56 void Decode(const BitstreamBuffer& bitstream_buffer) override; |
56 void AssignPictureBuffers(const std::vector<PictureBuffer>& buffers) override; | 57 void AssignPictureBuffers(const std::vector<PictureBuffer>& buffers) override; |
57 void ReusePictureBuffer(int32_t picture_buffer_id) override; | 58 void ReusePictureBuffer(int32_t picture_buffer_id) override; |
58 void Flush() override; | 59 void Flush() override; |
59 void Reset() override; | 60 void Reset() override; |
| 61 void SetSurface(int32_t surface_id) override; |
60 void Destroy() override; | 62 void Destroy() override; |
61 bool TryToSetupDecodeOnSeparateThread( | 63 bool TryToSetupDecodeOnSeparateThread( |
62 const base::WeakPtr<Client>& decode_client, | 64 const base::WeakPtr<Client>& decode_client, |
63 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) | 65 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) |
64 override; | 66 override; |
65 | 67 |
66 // AVDAStateProvider implementation: | 68 // AVDAStateProvider implementation: |
67 const gfx::Size& GetSize() const override; | 69 const gfx::Size& GetSize() const override; |
68 base::WeakPtr<gpu::gles2::GLES2Decoder> GetGlDecoder() const override; | 70 base::WeakPtr<gpu::gles2::GLES2Decoder> GetGlDecoder() const override; |
69 void PostError(const ::tracked_objects::Location& from_here, | 71 void PostError(const ::tracked_objects::Location& from_here, |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 378 |
377 // Indicates if ResetCodecState() should be called upon the next call to | 379 // Indicates if ResetCodecState() should be called upon the next call to |
378 // Decode(). Allows us to avoid trashing the last few frames of a playback | 380 // Decode(). Allows us to avoid trashing the last few frames of a playback |
379 // when the EOS buffer is received. | 381 // when the EOS buffer is received. |
380 bool codec_needs_reset_; | 382 bool codec_needs_reset_; |
381 | 383 |
382 // True if surface creation and |picture_buffer_manager_| initialization has | 384 // True if surface creation and |picture_buffer_manager_| initialization has |
383 // been defered until the first Decode() call. | 385 // been defered until the first Decode() call. |
384 bool defer_surface_creation_; | 386 bool defer_surface_creation_; |
385 | 387 |
| 388 // Has a value if a SetSurface() call has occurred and a new surface should be |
| 389 // switched to when possible. Cleared during OnDestroyingSurface() and if all |
| 390 // pictures have been rendered in DequeueOutput(). |
| 391 int32_t surface_id_; |
| 392 base::Optional<int32_t> pending_surface_id_; |
| 393 |
386 // Copy of the VDA::Config we were given. | 394 // Copy of the VDA::Config we were given. |
387 Config config_; | 395 Config config_; |
388 | 396 |
389 OnDestroyingSurfaceCallback on_destroying_surface_cb_; | 397 OnDestroyingSurfaceCallback on_destroying_surface_cb_; |
390 | 398 |
391 // WeakPtrFactory for posting tasks back to |this|. | 399 // WeakPtrFactory for posting tasks back to |this|. |
392 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; | 400 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; |
393 | 401 |
394 friend class AndroidVideoDecodeAcceleratorTest; | 402 friend class AndroidVideoDecodeAcceleratorTest; |
395 }; | 403 }; |
396 | 404 |
397 } // namespace media | 405 } // namespace media |
398 | 406 |
399 #endif // MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 407 #endif // MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |