| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_AVDA_CODEC_ALLOCATOR_H_ | 5 #ifndef MEDIA_GPU_AVDA_CODEC_ALLOCATOR_H_ |
| 6 #define MEDIA_GPU_AVDA_CODEC_ALLOCATOR_H_ | 6 #define MEDIA_GPU_AVDA_CODEC_ALLOCATOR_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 SW_CODEC = 1, | 41 SW_CODEC = 1, |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 // Configuration info for MediaCodec. | 44 // Configuration info for MediaCodec. |
| 45 // This is used to shuttle configuration info between threads without needing | 45 // This is used to shuttle configuration info between threads without needing |
| 46 // to worry about the lifetime of the AVDA instance. | 46 // to worry about the lifetime of the AVDA instance. |
| 47 class CodecConfig : public base::RefCountedThreadSafe<CodecConfig> { | 47 class CodecConfig : public base::RefCountedThreadSafe<CodecConfig> { |
| 48 public: | 48 public: |
| 49 CodecConfig(); | 49 CodecConfig(); |
| 50 | 50 |
| 51 // Codec type. Used when we configure media codec. | 51 VideoCodec codec = kUnknownVideoCodec; |
| 52 VideoCodec codec_ = kUnknownVideoCodec; | |
| 53 | |
| 54 // Whether encryption scheme requires to use protected surface. | |
| 55 bool needs_protected_surface_ = false; | |
| 56 | 52 |
| 57 // The surface that MediaCodec is configured to output to. | 53 // The surface that MediaCodec is configured to output to. |
| 58 gl::ScopedJavaSurface surface_; | 54 gl::ScopedJavaSurface surface; |
| 55 int surface_id = SurfaceManager::kNoSurfaceID; |
| 59 | 56 |
| 60 int surface_id_ = SurfaceManager::kNoSurfaceID; | 57 // The MediaCrypto that MediaCodec is configured with for an encrypted stream. |
| 58 MediaDrmBridgeCdmContext::JavaObjectPtr media_crypto; |
| 61 | 59 |
| 62 // The MediaCrypto object is used in the MediaCodec.configure() in case of | 60 // Whether the encryption scheme requires us to use a protected surface. |
| 63 // an encrypted stream. | 61 bool needs_protected_surface = false; |
| 64 MediaDrmBridgeCdmContext::JavaObjectPtr media_crypto_; | |
| 65 | 62 |
| 66 // Initial coded size. The actual size might change at any time, so this | 63 // The initial coded size. The actual size might change at any time, so this |
| 67 // is only a hint. | 64 // is only a hint. |
| 68 gfx::Size initial_expected_coded_size_; | 65 gfx::Size initial_expected_coded_size; |
| 69 | 66 |
| 70 // The type of allocation to use for this. We use this to select the right | 67 // The type of allocation to use for. We use this to select the right thread |
| 71 // thread for construction / destruction, and to decide if we should | 68 // for construction / destruction, and to decide if we should restrict the |
| 72 // restrict the codec to be software only. | 69 // codec to be software only. |
| 73 TaskType task_type_; | 70 TaskType task_type; |
| 74 | 71 |
| 75 // Codec specific data (SPS and PPS for H264). | 72 // Codec specific data (SPS and PPS for H264). |
| 76 std::vector<uint8_t> csd0_; | 73 std::vector<uint8_t> csd0; |
| 77 std::vector<uint8_t> csd1_; | 74 std::vector<uint8_t> csd1; |
| 78 | 75 |
| 79 protected: | 76 protected: |
| 80 friend class base::RefCountedThreadSafe<CodecConfig>; | 77 friend class base::RefCountedThreadSafe<CodecConfig>; |
| 81 virtual ~CodecConfig(); | 78 virtual ~CodecConfig(); |
| 82 | 79 |
| 83 private: | 80 private: |
| 84 DISALLOW_COPY_AND_ASSIGN(CodecConfig); | 81 DISALLOW_COPY_AND_ASSIGN(CodecConfig); |
| 85 }; | 82 }; |
| 86 | 83 |
| 87 class AVDACodecAllocatorClient { | 84 class AVDACodecAllocatorClient { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 232 |
| 236 // For canceling pending StopThreadTask()s. | 233 // For canceling pending StopThreadTask()s. |
| 237 base::WeakPtrFactory<AVDACodecAllocator> weak_this_factory_; | 234 base::WeakPtrFactory<AVDACodecAllocator> weak_this_factory_; |
| 238 | 235 |
| 239 DISALLOW_COPY_AND_ASSIGN(AVDACodecAllocator); | 236 DISALLOW_COPY_AND_ASSIGN(AVDACodecAllocator); |
| 240 }; | 237 }; |
| 241 | 238 |
| 242 } // namespace media | 239 } // namespace media |
| 243 | 240 |
| 244 #endif // MEDIA_GPU_AVDA_CODEC_ALLOCATOR_H_ | 241 #endif // MEDIA_GPU_AVDA_CODEC_ALLOCATOR_H_ |
| OLD | NEW |