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