| OLD | NEW |
| 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_GPU_VIDEO_DECODER_H_ | 5 #ifndef MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ |
| 6 #define MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ | 6 #define MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <list> | 11 #include <list> |
| 12 #include <map> | 12 #include <map> |
| 13 #include <set> | 13 #include <set> |
| 14 #include <utility> | 14 #include <utility> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "media/base/pipeline_status.h" | 19 #include "media/base/pipeline_status.h" |
| 20 #include "media/base/surface_manager.h" |
| 20 #include "media/base/video_decoder.h" | 21 #include "media/base/video_decoder.h" |
| 21 #include "media/video/video_decode_accelerator.h" | 22 #include "media/video/video_decode_accelerator.h" |
| 22 | 23 |
| 23 template <class T> class scoped_refptr; | 24 template <class T> class scoped_refptr; |
| 24 | 25 |
| 25 namespace base { | 26 namespace base { |
| 26 class SharedMemory; | 27 class SharedMemory; |
| 27 class SingleThreadTaskRunner; | 28 class SingleThreadTaskRunner; |
| 28 } | 29 } |
| 29 | 30 |
| 30 namespace gpu { | 31 namespace gpu { |
| 31 struct SyncToken; | 32 struct SyncToken; |
| 32 } | 33 } |
| 33 | 34 |
| 34 namespace media { | 35 namespace media { |
| 35 | 36 |
| 36 class DecoderBuffer; | 37 class DecoderBuffer; |
| 37 class GpuVideoAcceleratorFactories; | 38 class GpuVideoAcceleratorFactories; |
| 38 class MediaLog; | 39 class MediaLog; |
| 39 | 40 |
| 40 // GPU-accelerated video decoder implementation. Relies on | 41 // GPU-accelerated video decoder implementation. Relies on |
| 41 // AcceleratedVideoDecoderMsg_Decode and friends. Can be created on any thread | 42 // AcceleratedVideoDecoderMsg_Decode and friends. Can be created on any thread |
| 42 // but must be accessed and destroyed on GpuVideoAcceleratorFactories's | 43 // but must be accessed and destroyed on GpuVideoAcceleratorFactories's |
| 43 // GetMessageLoop(). | 44 // GetMessageLoop(). |
| 44 class MEDIA_EXPORT GpuVideoDecoder | 45 class MEDIA_EXPORT GpuVideoDecoder |
| 45 : public VideoDecoder, | 46 : public VideoDecoder, |
| 46 public VideoDecodeAccelerator::Client { | 47 public VideoDecodeAccelerator::Client { |
| 47 public: | 48 public: |
| 48 explicit GpuVideoDecoder(GpuVideoAcceleratorFactories* factories); | 49 explicit GpuVideoDecoder(GpuVideoAcceleratorFactories* factories, |
| 50 const RequestSurfaceCB& request_surface_cb); |
| 49 | 51 |
| 50 // VideoDecoder implementation. | 52 // VideoDecoder implementation. |
| 51 std::string GetDisplayName() const override; | 53 std::string GetDisplayName() const override; |
| 52 void Initialize(const VideoDecoderConfig& config, | 54 void Initialize(const VideoDecoderConfig& config, |
| 53 bool low_delay, | 55 bool low_delay, |
| 54 const SetCdmReadyCB& set_cdm_ready_cb, | 56 const SetCdmReadyCB& set_cdm_ready_cb, |
| 55 const InitCB& init_cb, | 57 const InitCB& init_cb, |
| 56 const OutputCB& output_cb) override; | 58 const OutputCB& output_cb) override; |
| 59 void CompleteInitialization(int surface_id); |
| 57 void Decode(const scoped_refptr<DecoderBuffer>& buffer, | 60 void Decode(const scoped_refptr<DecoderBuffer>& buffer, |
| 58 const DecodeCB& decode_cb) override; | 61 const DecodeCB& decode_cb) override; |
| 59 void Reset(const base::Closure& closure) override; | 62 void Reset(const base::Closure& closure) override; |
| 60 bool NeedsBitstreamConversion() const override; | 63 bool NeedsBitstreamConversion() const override; |
| 61 bool CanReadWithoutStalling() const override; | 64 bool CanReadWithoutStalling() const override; |
| 62 int GetMaxDecodeRequests() const override; | 65 int GetMaxDecodeRequests() const override; |
| 63 | 66 |
| 64 // VideoDecodeAccelerator::Client implementation. | 67 // VideoDecodeAccelerator::Client implementation. |
| 65 void NotifyCdmAttached(bool success) override; | 68 void NotifyCdmAttached(bool success) override; |
| 66 void ProvidePictureBuffers(uint32_t count, | 69 void ProvidePictureBuffers(uint32_t count, |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 167 |
| 165 DecodeCB eos_decode_cb_; | 168 DecodeCB eos_decode_cb_; |
| 166 | 169 |
| 167 // Not null only during reset. | 170 // Not null only during reset. |
| 168 base::Closure pending_reset_cb_; | 171 base::Closure pending_reset_cb_; |
| 169 | 172 |
| 170 State state_; | 173 State state_; |
| 171 | 174 |
| 172 VideoDecoderConfig config_; | 175 VideoDecoderConfig config_; |
| 173 | 176 |
| 177 RequestSurfaceCB request_surface_cb_; |
| 178 |
| 174 // Callback to request/cancel CDM ready notification. | 179 // Callback to request/cancel CDM ready notification. |
| 175 SetCdmReadyCB set_cdm_ready_cb_; | 180 SetCdmReadyCB set_cdm_ready_cb_; |
| 176 CdmAttachedCB cdm_attached_cb_; | 181 CdmAttachedCB cdm_attached_cb_; |
| 177 | 182 |
| 178 // Shared-memory buffer pool. Since allocating SHM segments requires a | 183 // Shared-memory buffer pool. Since allocating SHM segments requires a |
| 179 // round-trip to the browser process, we keep allocation out of the | 184 // round-trip to the browser process, we keep allocation out of the |
| 180 // steady-state of the decoder. | 185 // steady-state of the decoder. |
| 181 std::vector<SHMBuffer*> available_shm_segments_; | 186 std::vector<SHMBuffer*> available_shm_segments_; |
| 182 | 187 |
| 183 std::map<int32_t, PendingDecoderBuffer> bitstream_buffers_in_decoder_; | 188 std::map<int32_t, PendingDecoderBuffer> bitstream_buffers_in_decoder_; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 // Bound to factories_->GetMessageLoop(). | 228 // Bound to factories_->GetMessageLoop(). |
| 224 // NOTE: Weak pointers must be invalidated before all other member variables. | 229 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 225 base::WeakPtrFactory<GpuVideoDecoder> weak_factory_; | 230 base::WeakPtrFactory<GpuVideoDecoder> weak_factory_; |
| 226 | 231 |
| 227 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); | 232 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); |
| 228 }; | 233 }; |
| 229 | 234 |
| 230 } // namespace media | 235 } // namespace media |
| 231 | 236 |
| 232 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ | 237 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ |
| OLD | NEW |