| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 PPAPI_PROXY_VIDEO_DECODER_RESOURCE_H_ | 5 #ifndef PPAPI_PROXY_VIDEO_DECODER_RESOURCE_H_ |
| 6 #define PPAPI_PROXY_VIDEO_DECODER_RESOURCE_H_ | 6 #define PPAPI_PROXY_VIDEO_DECODER_RESOURCE_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 // Resource overrides. | 42 // Resource overrides. |
| 43 thunk::PPB_VideoDecoder_API* AsPPB_VideoDecoder_API() override; | 43 thunk::PPB_VideoDecoder_API* AsPPB_VideoDecoder_API() override; |
| 44 | 44 |
| 45 // PPB_VideoDecoder_API implementation. | 45 // PPB_VideoDecoder_API implementation. |
| 46 int32_t Initialize0_1( | 46 int32_t Initialize0_1( |
| 47 PP_Resource graphics_context, | 47 PP_Resource graphics_context, |
| 48 PP_VideoProfile profile, | 48 PP_VideoProfile profile, |
| 49 PP_Bool allow_software_fallback, | 49 PP_Bool allow_software_fallback, |
| 50 scoped_refptr<TrackedCallback> callback) override; | 50 scoped_refptr<TrackedCallback> callback) override; |
| 51 int32_t Initialize0_2( |
| 52 PP_Resource graphics_context, |
| 53 PP_VideoProfile profile, |
| 54 PP_HardwareAcceleration acceleration, |
| 55 scoped_refptr<TrackedCallback> callback) override; |
| 51 int32_t Initialize(PP_Resource graphics_context, | 56 int32_t Initialize(PP_Resource graphics_context, |
| 52 PP_VideoProfile profile, | 57 PP_VideoProfile profile, |
| 53 PP_HardwareAcceleration acceleration, | 58 PP_HardwareAcceleration acceleration, |
| 59 uint32_t min_picture_count, |
| 54 scoped_refptr<TrackedCallback> callback) override; | 60 scoped_refptr<TrackedCallback> callback) override; |
| 55 int32_t Decode(uint32_t decode_id, | 61 int32_t Decode(uint32_t decode_id, |
| 56 uint32_t size, | 62 uint32_t size, |
| 57 const void* buffer, | 63 const void* buffer, |
| 58 scoped_refptr<TrackedCallback> callback) override; | 64 scoped_refptr<TrackedCallback> callback) override; |
| 59 int32_t GetPicture0_1( | 65 int32_t GetPicture0_1( |
| 60 PP_VideoPicture_0_1* picture, | 66 PP_VideoPicture_0_1* picture, |
| 61 scoped_refptr<TrackedCallback> callback) override; | 67 scoped_refptr<TrackedCallback> callback) override; |
| 62 int32_t GetPicture(PP_VideoPicture* picture, | 68 int32_t GetPicture(PP_VideoPicture* picture, |
| 63 scoped_refptr<TrackedCallback> callback) override; | 69 scoped_refptr<TrackedCallback> callback) override; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 int32_t num_decodes_; | 167 int32_t num_decodes_; |
| 162 // The maximum delay (in Decode calls) before we receive a picture. If we | 168 // The maximum delay (in Decode calls) before we receive a picture. If we |
| 163 // haven't received a picture from a Decode call after this many successive | 169 // haven't received a picture from a Decode call after this many successive |
| 164 // calls to Decode, then we will never receive a picture from the call. | 170 // calls to Decode, then we will never receive a picture from the call. |
| 165 // Note that this isn't guaranteed by H264 or other codecs. In practice, this | 171 // Note that this isn't guaranteed by H264 or other codecs. In practice, this |
| 166 // number is less than 16. Make it much larger just to be safe. | 172 // number is less than 16. Make it much larger just to be safe. |
| 167 // NOTE: because we count decodes mod 2^31, this value must be a power of 2. | 173 // NOTE: because we count decodes mod 2^31, this value must be a power of 2. |
| 168 static const int kMaximumPictureDelay = 128; | 174 static const int kMaximumPictureDelay = 128; |
| 169 uint32_t decode_ids_[kMaximumPictureDelay]; | 175 uint32_t decode_ids_[kMaximumPictureDelay]; |
| 170 | 176 |
| 177 // The maximum number of pictures that the client can pass in for |
| 178 // min_picture_count, just as a sanity check on the argument. |
| 179 static const uint32_t kMaximumPictureCount = 100; |
| 180 uint32_t min_picture_count_; |
| 181 |
| 171 // State for pending get_picture_callback_. | 182 // State for pending get_picture_callback_. |
| 172 PP_VideoPicture* get_picture_; | 183 PP_VideoPicture* get_picture_; |
| 173 PP_VideoPicture_0_1* get_picture_0_1_; | 184 PP_VideoPicture_0_1* get_picture_0_1_; |
| 174 | 185 |
| 175 ScopedPPResource graphics3d_; | 186 ScopedPPResource graphics3d_; |
| 176 gpu::gles2::GLES2Implementation* gles2_impl_; | 187 gpu::gles2::GLES2Implementation* gles2_impl_; |
| 177 | 188 |
| 178 bool initialized_; | 189 bool initialized_; |
| 179 bool testing_; | 190 bool testing_; |
| 180 int32_t decoder_last_error_; | 191 int32_t decoder_last_error_; |
| 181 | 192 |
| 182 DISALLOW_COPY_AND_ASSIGN(VideoDecoderResource); | 193 DISALLOW_COPY_AND_ASSIGN(VideoDecoderResource); |
| 183 }; | 194 }; |
| 184 | 195 |
| 185 } // namespace proxy | 196 } // namespace proxy |
| 186 } // namespace ppapi | 197 } // namespace ppapi |
| 187 | 198 |
| 188 #endif // PPAPI_PROXY_VIDEO_DECODER_RESOURCE_H_ | 199 #endif // PPAPI_PROXY_VIDEO_DECODER_RESOURCE_H_ |
| OLD | NEW |