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/safe_numerics.h" | 10 #include "base/safe_numerics.h" |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 video_decode_cb.Run(media::Decryptor::kError, NULL); | 816 video_decode_cb.Run(media::Decryptor::kError, NULL); |
817 return; | 817 return; |
818 } | 818 } |
819 | 819 |
820 gfx::Size frame_size(frame_info->width, frame_info->height); | 820 gfx::Size frame_size(frame_info->width, frame_info->height); |
821 DCHECK_EQ(frame_info->format, PP_DECRYPTEDFRAMEFORMAT_YV12); | 821 DCHECK_EQ(frame_info->format, PP_DECRYPTEDFRAMEFORMAT_YV12); |
822 | 822 |
823 scoped_refptr<media::VideoFrame> decoded_frame = | 823 scoped_refptr<media::VideoFrame> decoded_frame = |
824 media::VideoFrame::WrapExternalYuvData( | 824 media::VideoFrame::WrapExternalYuvData( |
825 media::VideoFrame::YV12, | 825 media::VideoFrame::YV12, |
826 frame_size, gfx::Rect(frame_size), natural_size_, | 826 frame_size, |
| 827 gfx::Rect(frame_size), |
| 828 natural_size_, |
827 frame_info->strides[PP_DECRYPTEDFRAMEPLANES_Y], | 829 frame_info->strides[PP_DECRYPTEDFRAMEPLANES_Y], |
828 frame_info->strides[PP_DECRYPTEDFRAMEPLANES_U], | 830 frame_info->strides[PP_DECRYPTEDFRAMEPLANES_U], |
829 frame_info->strides[PP_DECRYPTEDFRAMEPLANES_V], | 831 frame_info->strides[PP_DECRYPTEDFRAMEPLANES_V], |
830 frame_data + frame_info->plane_offsets[PP_DECRYPTEDFRAMEPLANES_Y], | 832 frame_data + frame_info->plane_offsets[PP_DECRYPTEDFRAMEPLANES_Y], |
831 frame_data + frame_info->plane_offsets[PP_DECRYPTEDFRAMEPLANES_U], | 833 frame_data + frame_info->plane_offsets[PP_DECRYPTEDFRAMEPLANES_U], |
832 frame_data + frame_info->plane_offsets[PP_DECRYPTEDFRAMEPLANES_V], | 834 frame_data + frame_info->plane_offsets[PP_DECRYPTEDFRAMEPLANES_V], |
833 base::TimeDelta::FromMicroseconds( | 835 base::TimeDelta::FromMicroseconds( |
834 frame_info->tracking_info.timestamp), | 836 frame_info->tracking_info.timestamp), |
835 ppb_buffer->shared_memory()->handle(), | |
836 media::BindToLoop( | 837 media::BindToLoop( |
837 base::MessageLoopProxy::current(), | 838 base::MessageLoopProxy::current(), |
838 base::Bind(&BufferNoLongerNeeded, ppb_buffer, | 839 base::Bind(&BufferNoLongerNeeded, |
| 840 ppb_buffer, |
839 base::Bind(&ContentDecryptorDelegate::FreeBuffer, | 841 base::Bind(&ContentDecryptorDelegate::FreeBuffer, |
840 weak_this_, | 842 weak_this_, |
841 frame_info->tracking_info.buffer_id)))); | 843 frame_info->tracking_info.buffer_id)))); |
842 | 844 |
843 video_decode_cb.Run(media::Decryptor::kSuccess, decoded_frame); | 845 video_decode_cb.Run(media::Decryptor::kSuccess, decoded_frame); |
844 } | 846 } |
845 | 847 |
846 void ContentDecryptorDelegate::DeliverSamples( | 848 void ContentDecryptorDelegate::DeliverSamples( |
847 PP_Resource audio_frames, | 849 PP_Resource audio_frames, |
848 const PP_DecryptedBlockInfo* block_info) { | 850 const PP_DecryptedBlockInfo* block_info) { |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 frames->push_back(frame); | 1042 frames->push_back(frame); |
1041 | 1043 |
1042 cur += frame_size; | 1044 cur += frame_size; |
1043 bytes_left -= frame_size; | 1045 bytes_left -= frame_size; |
1044 } while (bytes_left > 0); | 1046 } while (bytes_left > 0); |
1045 | 1047 |
1046 return true; | 1048 return true; |
1047 } | 1049 } |
1048 | 1050 |
1049 } // namespace content | 1051 } // namespace content |
OLD | NEW |