| 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 #include "content/renderer/pepper/pepper_video_decoder_host.h" | 5 #include "content/renderer/pepper/pepper_video_decoder_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
| 9 #include "content/common/gpu/client/command_buffer_proxy_impl.h" | 9 #include "content/common/gpu/client/command_buffer_proxy_impl.h" |
| 10 #include "content/common/pepper_file_util.h" | 10 #include "content/common/pepper_file_util.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 PPB_Graphics3D_Impl* graphics3d = | 130 PPB_Graphics3D_Impl* graphics3d = |
| 131 static_cast<PPB_Graphics3D_Impl*>(enter_graphics.object()); | 131 static_cast<PPB_Graphics3D_Impl*>(enter_graphics.object()); |
| 132 | 132 |
| 133 CommandBufferProxyImpl* command_buffer = graphics3d->GetCommandBufferProxy(); | 133 CommandBufferProxyImpl* command_buffer = graphics3d->GetCommandBufferProxy(); |
| 134 if (!command_buffer) | 134 if (!command_buffer) |
| 135 return PP_ERROR_FAILED; | 135 return PP_ERROR_FAILED; |
| 136 | 136 |
| 137 profile_ = PepperToMediaVideoProfile(profile); | 137 profile_ = PepperToMediaVideoProfile(profile); |
| 138 software_fallback_allowed_ = (acceleration != PP_HARDWAREACCELERATION_ONLY); | 138 software_fallback_allowed_ = (acceleration != PP_HARDWAREACCELERATION_ONLY); |
| 139 | 139 |
| 140 // Check for Dev API use | |
| 141 // TODO(lpique): remove check when PPB_VideoDecoder_1_1 reaches beta/stable. | |
| 142 // https://crbug.com/520323 | |
| 143 if (min_picture_count != 0) { | |
| 144 ContentRendererClient* client = GetContentClient()->renderer(); | |
| 145 bool allowed = client->IsPluginAllowedToUseDevChannelAPIs(); | |
| 146 if (!allowed) | |
| 147 return PP_ERROR_NOTSUPPORTED; | |
| 148 } | |
| 149 min_picture_count_ = min_picture_count; | 140 min_picture_count_ = min_picture_count; |
| 150 | 141 |
| 151 if (acceleration != PP_HARDWAREACCELERATION_NONE) { | 142 if (acceleration != PP_HARDWAREACCELERATION_NONE) { |
| 152 // This is not synchronous, but subsequent IPC messages will be buffered, so | 143 // This is not synchronous, but subsequent IPC messages will be buffered, so |
| 153 // it is okay to immediately send IPC messages. | 144 // it is okay to immediately send IPC messages. |
| 154 decoder_ = command_buffer->CreateVideoDecoder(); | 145 decoder_ = command_buffer->CreateVideoDecoder(); |
| 155 if (decoder_ && decoder_->Initialize(profile_, this)) { | 146 if (decoder_ && decoder_->Initialize(profile_, this)) { |
| 156 initialized_ = true; | 147 initialized_ = true; |
| 157 return PP_OK; | 148 return PP_OK; |
| 158 } | 149 } |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 | 522 |
| 532 PepperVideoDecoderHost::PendingDecodeList::iterator | 523 PepperVideoDecoderHost::PendingDecodeList::iterator |
| 533 PepperVideoDecoderHost::GetPendingDecodeById(int32_t decode_id) { | 524 PepperVideoDecoderHost::GetPendingDecodeById(int32_t decode_id) { |
| 534 return std::find_if(pending_decodes_.begin(), pending_decodes_.end(), | 525 return std::find_if(pending_decodes_.begin(), pending_decodes_.end(), |
| 535 [decode_id](const PendingDecode& item) { | 526 [decode_id](const PendingDecode& item) { |
| 536 return item.decode_id == decode_id; | 527 return item.decode_id == decode_id; |
| 537 }); | 528 }); |
| 538 } | 529 } |
| 539 | 530 |
| 540 } // namespace content | 531 } // namespace content |
| OLD | NEW |