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