| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/pepper_video_source_host.h" | 5 #include "content/renderer/pepper/pepper_video_source_host.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 return; | 214 return; |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 | 217 |
| 218 SkBitmap bitmap(shared_image_->GetMappedBitmap()); | 218 SkBitmap bitmap(shared_image_->GetMappedBitmap()); |
| 219 if (bitmap.empty()) { | 219 if (bitmap.empty()) { |
| 220 SendGetFrameErrorReply(PP_ERROR_FAILED); | 220 SendGetFrameErrorReply(PP_ERROR_FAILED); |
| 221 return; | 221 return; |
| 222 } | 222 } |
| 223 | 223 |
| 224 SkAutoLockPixels lock(bitmap); | |
| 225 uint8_t* bitmap_pixels = static_cast<uint8_t*>(bitmap.getPixels()); | 224 uint8_t* bitmap_pixels = static_cast<uint8_t*>(bitmap.getPixels()); |
| 226 if (!bitmap_pixels) { | 225 if (!bitmap_pixels) { |
| 227 SendGetFrameErrorReply(PP_ERROR_FAILED); | 226 SendGetFrameErrorReply(PP_ERROR_FAILED); |
| 228 return; | 227 return; |
| 229 } | 228 } |
| 230 | 229 |
| 231 // Calculate the portion of the |last_frame_| that should be copied into | 230 // Calculate the portion of the |last_frame_| that should be copied into |
| 232 // |bitmap|. If |last_frame_| is lazily scaled, then | 231 // |bitmap|. If |last_frame_| is lazily scaled, then |
| 233 // last_frame_->visible_rect()._size() != last_frame_.natural_size(). | 232 // last_frame_->visible_rect()._size() != last_frame_.natural_size(). |
| 234 scoped_refptr<media::VideoFrame> frame; | 233 scoped_refptr<media::VideoFrame> frame; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 if (frame_source_.get() && !stream_url_.empty()) | 313 if (frame_source_.get() && !stream_url_.empty()) |
| 315 frame_source_->Close(frame_receiver_.get()); | 314 frame_source_->Close(frame_receiver_.get()); |
| 316 | 315 |
| 317 frame_source_.reset(NULL); | 316 frame_source_.reset(NULL); |
| 318 stream_url_.clear(); | 317 stream_url_.clear(); |
| 319 | 318 |
| 320 shared_image_ = NULL; | 319 shared_image_ = NULL; |
| 321 } | 320 } |
| 322 | 321 |
| 323 } // namespace content | 322 } // namespace content |
| OLD | NEW |