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 <string.h> | 7 #include <string.h> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 media::VideoFrame::WrapExternalYuvData( | 1031 media::VideoFrame::WrapExternalYuvData( |
1032 media::PIXEL_FORMAT_YV12, frame_size, gfx::Rect(frame_size), | 1032 media::PIXEL_FORMAT_YV12, frame_size, gfx::Rect(frame_size), |
1033 natural_size_, frame_info->strides[PP_DECRYPTEDFRAMEPLANES_Y], | 1033 natural_size_, frame_info->strides[PP_DECRYPTEDFRAMEPLANES_Y], |
1034 frame_info->strides[PP_DECRYPTEDFRAMEPLANES_U], | 1034 frame_info->strides[PP_DECRYPTEDFRAMEPLANES_U], |
1035 frame_info->strides[PP_DECRYPTEDFRAMEPLANES_V], | 1035 frame_info->strides[PP_DECRYPTEDFRAMEPLANES_V], |
1036 frame_data + frame_info->plane_offsets[PP_DECRYPTEDFRAMEPLANES_Y], | 1036 frame_data + frame_info->plane_offsets[PP_DECRYPTEDFRAMEPLANES_Y], |
1037 frame_data + frame_info->plane_offsets[PP_DECRYPTEDFRAMEPLANES_U], | 1037 frame_data + frame_info->plane_offsets[PP_DECRYPTEDFRAMEPLANES_U], |
1038 frame_data + frame_info->plane_offsets[PP_DECRYPTEDFRAMEPLANES_V], | 1038 frame_data + frame_info->plane_offsets[PP_DECRYPTEDFRAMEPLANES_V], |
1039 base::TimeDelta::FromMicroseconds( | 1039 base::TimeDelta::FromMicroseconds( |
1040 frame_info->tracking_info.timestamp)); | 1040 frame_info->tracking_info.timestamp)); |
| 1041 if (!decoded_frame) { |
| 1042 FreeBuffer(frame_info->tracking_info.buffer_id); |
| 1043 video_decode_cb.Run(Decryptor::kError, NULL); |
| 1044 return; |
| 1045 } |
1041 decoded_frame->AddDestructionObserver( | 1046 decoded_frame->AddDestructionObserver( |
1042 media::BindToCurrentLoop( | 1047 media::BindToCurrentLoop( |
1043 base::Bind(&BufferNoLongerNeeded, | 1048 base::Bind(&BufferNoLongerNeeded, |
1044 ppb_buffer, | 1049 ppb_buffer, |
1045 base::Bind(&ContentDecryptorDelegate::FreeBuffer, | 1050 base::Bind(&ContentDecryptorDelegate::FreeBuffer, |
1046 weak_this_, | 1051 weak_this_, |
1047 frame_info->tracking_info.buffer_id)))); | 1052 frame_info->tracking_info.buffer_id)))); |
1048 | 1053 |
1049 video_decode_cb.Run(Decryptor::kSuccess, decoded_frame); | 1054 video_decode_cb.Run(Decryptor::kSuccess, decoded_frame); |
1050 } | 1055 } |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 empty_frames); | 1289 empty_frames); |
1285 } | 1290 } |
1286 | 1291 |
1287 if (!video_decode_cb_.is_null()) | 1292 if (!video_decode_cb_.is_null()) |
1288 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL); | 1293 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL); |
1289 | 1294 |
1290 cdm_promise_adapter_.Clear(); | 1295 cdm_promise_adapter_.Clear(); |
1291 } | 1296 } |
1292 | 1297 |
1293 } // namespace content | 1298 } // namespace content |
OLD | NEW |