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 "content/renderer/pepper/content_decryptor_delegate.h" | 5 #include "content/renderer/pepper/content_decryptor_delegate.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "base/metrics/sparse_histogram.h" | 10 #include "base/metrics/sparse_histogram.h" |
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
959 if (!mapper.data() || !mapper.size() || | 959 if (!mapper.data() || !mapper.size() || |
960 mapper.size() < block_info->data_size) { | 960 mapper.size() < block_info->data_size) { |
961 decrypt_cb.Run(Decryptor::kError, NULL); | 961 decrypt_cb.Run(Decryptor::kError, NULL); |
962 return; | 962 return; |
963 } | 963 } |
964 | 964 |
965 // TODO(tomfinegan): Find a way to take ownership of the shared memory | 965 // TODO(tomfinegan): Find a way to take ownership of the shared memory |
966 // managed by the PPB_Buffer_Dev, and avoid the extra copy. | 966 // managed by the PPB_Buffer_Dev, and avoid the extra copy. |
967 scoped_refptr<media::DecoderBuffer> decrypted_buffer( | 967 scoped_refptr<media::DecoderBuffer> decrypted_buffer( |
968 media::DecoderBuffer::CopyFrom(static_cast<uint8*>(mapper.data()), | 968 media::DecoderBuffer::CopyFrom(static_cast<uint8*>(mapper.data()), |
969 block_info->data_size)); | 969 block_info->data_size, |
970 false)); | |
dmichael (off chromium)
2014/11/10 17:22:24
I usually prefer enums to bools for the sake of re
wolenetz
2014/11/11 22:39:41
This file will remain unchanged in this CL by foll
| |
970 decrypted_buffer->set_timestamp( | 971 decrypted_buffer->set_timestamp( |
971 base::TimeDelta::FromMicroseconds(block_info->tracking_info.timestamp)); | 972 base::TimeDelta::FromMicroseconds(block_info->tracking_info.timestamp)); |
972 decrypt_cb.Run(Decryptor::kSuccess, decrypted_buffer); | 973 decrypt_cb.Run(Decryptor::kSuccess, decrypted_buffer); |
973 } | 974 } |
974 | 975 |
975 // Use a non-class-member function here so that if for some reason | 976 // Use a non-class-member function here so that if for some reason |
976 // ContentDecryptorDelegate is destroyed before VideoFrame calls this callback, | 977 // ContentDecryptorDelegate is destroyed before VideoFrame calls this callback, |
977 // we can still get the shared memory unmapped. | 978 // we can still get the shared memory unmapped. |
978 static void BufferNoLongerNeeded( | 979 static void BufferNoLongerNeeded( |
979 const scoped_refptr<PPB_Buffer_Impl>& ppb_buffer, | 980 const scoped_refptr<PPB_Buffer_Impl>& ppb_buffer, |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1324 | 1325 |
1325 scoped_ptr<CdmPromise> ContentDecryptorDelegate::TakePromise( | 1326 scoped_ptr<CdmPromise> ContentDecryptorDelegate::TakePromise( |
1326 uint32_t promise_id) { | 1327 uint32_t promise_id) { |
1327 PromiseMap::iterator it = promises_.find(promise_id); | 1328 PromiseMap::iterator it = promises_.find(promise_id); |
1328 if (it == promises_.end()) | 1329 if (it == promises_.end()) |
1329 return scoped_ptr<CdmPromise>(); | 1330 return scoped_ptr<CdmPromise>(); |
1330 return promises_.take_and_erase(it); | 1331 return promises_.take_and_erase(it); |
1331 } | 1332 } |
1332 | 1333 |
1333 } // namespace content | 1334 } // namespace content |
OLD | NEW |