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 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
(...skipping 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1537 return false; | 1537 return false; |
1538 plugin_decryption_interface_->CancelKeyRequest( | 1538 plugin_decryption_interface_->CancelKeyRequest( |
1539 pp_instance(), | 1539 pp_instance(), |
1540 StringVar::StringToPPVar(session_id)); | 1540 StringVar::StringToPPVar(session_id)); |
1541 return true; | 1541 return true; |
1542 } | 1542 } |
1543 | 1543 |
1544 bool PluginInstance::Decrypt( | 1544 bool PluginInstance::Decrypt( |
1545 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, | 1545 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, |
1546 const media::Decryptor::DecryptCB& decrypt_cb) { | 1546 const media::Decryptor::DecryptCB& decrypt_cb) { |
| 1547 DVLOG(3) << "Decrypt()"; |
1547 if (!LoadContentDecryptorInterface()) | 1548 if (!LoadContentDecryptorInterface()) |
1548 return false; | 1549 return false; |
1549 | 1550 |
1550 ScopedPPResource encrypted_resource( | 1551 ScopedPPResource encrypted_resource( |
1551 ScopedPPResource::PassRef(), | 1552 ScopedPPResource::PassRef(), |
1552 MakeBufferResource(pp_instance(), | 1553 MakeBufferResource(pp_instance(), |
1553 encrypted_buffer->GetData(), | 1554 encrypted_buffer->GetData(), |
1554 encrypted_buffer->GetDataSize())); | 1555 encrypted_buffer->GetDataSize())); |
1555 if (!encrypted_resource.get()) | 1556 if (!encrypted_resource.get()) |
1556 return false; | 1557 return false; |
1557 | 1558 |
1558 uint32_t request_id = next_decryption_request_id_++; | 1559 uint32_t request_id = next_decryption_request_id_++; |
| 1560 DVLOG(2) << "Decrypt() - request_id " << request_id; |
1559 | 1561 |
1560 PP_EncryptedBlockInfo block_info; | 1562 PP_EncryptedBlockInfo block_info; |
1561 DCHECK(encrypted_buffer->GetDecryptConfig()); | 1563 DCHECK(encrypted_buffer->GetDecryptConfig()); |
1562 if (!MakeEncryptedBlockInfo(*encrypted_buffer->GetDecryptConfig(), | 1564 if (!MakeEncryptedBlockInfo(*encrypted_buffer->GetDecryptConfig(), |
1563 encrypted_buffer->GetTimestamp().InMicroseconds(), | 1565 encrypted_buffer->GetTimestamp().InMicroseconds(), |
1564 request_id, | 1566 request_id, |
1565 &block_info)) { | 1567 &block_info)) { |
1566 return false; | 1568 return false; |
1567 } | 1569 } |
1568 | 1570 |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2384 | 2386 |
2385 void PluginInstance::DecoderResetDone(PP_Instance instance, | 2387 void PluginInstance::DecoderResetDone(PP_Instance instance, |
2386 PP_DecryptorStreamType decoder_type, | 2388 PP_DecryptorStreamType decoder_type, |
2387 uint32_t request_id) { | 2389 uint32_t request_id) { |
2388 // TODO(tomfinegan): Add decoder reset completion handling. | 2390 // TODO(tomfinegan): Add decoder reset completion handling. |
2389 } | 2391 } |
2390 | 2392 |
2391 void PluginInstance::DeliverBlock(PP_Instance instance, | 2393 void PluginInstance::DeliverBlock(PP_Instance instance, |
2392 PP_Resource decrypted_block, | 2394 PP_Resource decrypted_block, |
2393 const PP_DecryptedBlockInfo* block_info) { | 2395 const PP_DecryptedBlockInfo* block_info) { |
| 2396 DVLOG(2) << "DeliverBlock() - request_id: " |
| 2397 << block_info->tracking_info.request_id; |
2394 DCHECK(block_info); | 2398 DCHECK(block_info); |
2395 DecryptionCBMap::iterator found = pending_decryption_cbs_.find( | 2399 DecryptionCBMap::iterator found = pending_decryption_cbs_.find( |
2396 block_info->tracking_info.request_id); | 2400 block_info->tracking_info.request_id); |
2397 if (found == pending_decryption_cbs_.end()) | 2401 if (found == pending_decryption_cbs_.end()) |
2398 return; | 2402 return; |
2399 media::Decryptor::DecryptCB decrypt_cb = found->second; | 2403 media::Decryptor::DecryptCB decrypt_cb = found->second; |
2400 pending_decryption_cbs_.erase(found); | 2404 pending_decryption_cbs_.erase(found); |
2401 | 2405 |
2402 if (block_info->result == PP_DECRYPTRESULT_DECRYPT_NOKEY) { | 2406 if (block_info->result == PP_DECRYPTRESULT_DECRYPT_NOKEY) { |
2403 decrypt_cb.Run(media::Decryptor::kNoKey, NULL); | 2407 decrypt_cb.Run(media::Decryptor::kNoKey, NULL); |
(...skipping 21 matching lines...) Expand all Loading... |
2425 media::DecoderBuffer::CopyFrom( | 2429 media::DecoderBuffer::CopyFrom( |
2426 reinterpret_cast<const uint8*>(mapper.data()), mapper.size())); | 2430 reinterpret_cast<const uint8*>(mapper.data()), mapper.size())); |
2427 decrypted_buffer->SetTimestamp(base::TimeDelta::FromMicroseconds( | 2431 decrypted_buffer->SetTimestamp(base::TimeDelta::FromMicroseconds( |
2428 block_info->tracking_info.timestamp)); | 2432 block_info->tracking_info.timestamp)); |
2429 decrypt_cb.Run(media::Decryptor::kSuccess, decrypted_buffer); | 2433 decrypt_cb.Run(media::Decryptor::kSuccess, decrypted_buffer); |
2430 } | 2434 } |
2431 | 2435 |
2432 void PluginInstance::DeliverFrame(PP_Instance instance, | 2436 void PluginInstance::DeliverFrame(PP_Instance instance, |
2433 PP_Resource decrypted_frame, | 2437 PP_Resource decrypted_frame, |
2434 const PP_DecryptedFrameInfo* frame_info) { | 2438 const PP_DecryptedFrameInfo* frame_info) { |
| 2439 DVLOG(2) << "DeliverFrame() - request_id: " |
| 2440 << frame_info->tracking_info.request_id; |
2435 // TODO(tomfinegan): To be implemented after completion of v0.1 of the | 2441 // TODO(tomfinegan): To be implemented after completion of v0.1 of the |
2436 // EME/CDM work. | 2442 // EME/CDM work. |
2437 } | 2443 } |
2438 | 2444 |
2439 void PluginInstance::DeliverSamples(PP_Instance instance, | 2445 void PluginInstance::DeliverSamples(PP_Instance instance, |
2440 PP_Resource decrypted_samples, | 2446 PP_Resource decrypted_samples, |
2441 const PP_DecryptedBlockInfo* block_info) { | 2447 const PP_DecryptedBlockInfo* block_info) { |
| 2448 DVLOG(2) << "DeliverSamples() - request_id: " |
| 2449 << block_info->tracking_info.request_id; |
2442 // TODO(tomfinegan): To be implemented after completion of v0.1 of the | 2450 // TODO(tomfinegan): To be implemented after completion of v0.1 of the |
2443 // EME/CDM work. | 2451 // EME/CDM work. |
2444 } | 2452 } |
2445 | 2453 |
2446 void PluginInstance::NumberOfFindResultsChanged(PP_Instance instance, | 2454 void PluginInstance::NumberOfFindResultsChanged(PP_Instance instance, |
2447 int32_t total, | 2455 int32_t total, |
2448 PP_Bool final_result) { | 2456 PP_Bool final_result) { |
2449 DCHECK_NE(find_identifier_, -1); | 2457 DCHECK_NE(find_identifier_, -1); |
2450 delegate_->NumberOfFindResultsChanged(find_identifier_, total, | 2458 delegate_->NumberOfFindResultsChanged(find_identifier_, total, |
2451 PP_ToBool(final_result)); | 2459 PP_ToBool(final_result)); |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2823 screen_size_for_fullscreen_ = gfx::Size(); | 2831 screen_size_for_fullscreen_ = gfx::Size(); |
2824 WebElement element = container_->element(); | 2832 WebElement element = container_->element(); |
2825 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2833 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
2826 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2834 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
2827 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2835 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
2828 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2836 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
2829 } | 2837 } |
2830 | 2838 |
2831 } // namespace ppapi | 2839 } // namespace ppapi |
2832 } // namespace webkit | 2840 } // namespace webkit |
OLD | NEW |