Chromium Code Reviews| Index: content/browser/renderer_host/media/video_capture_controller.cc |
| diff --git a/content/browser/renderer_host/media/video_capture_controller.cc b/content/browser/renderer_host/media/video_capture_controller.cc |
| index 1962516aa52ec55e8a0b5fdaf397751adcc88b21..bc771d8ac7917fe3498777f19dc7a114bb7c39f1 100644 |
| --- a/content/browser/renderer_host/media/video_capture_controller.cc |
| +++ b/content/browser/renderer_host/media/video_capture_controller.cc |
| @@ -396,6 +396,7 @@ void VideoCaptureController::OnIncomingCapturedFrame( |
| bool flip_horiz) { |
| DCHECK(frame_info_.color == media::PIXEL_FORMAT_I420 || |
| frame_info_.color == media::PIXEL_FORMAT_YV12 || |
| + frame_info_.color == media::PIXEL_FORMAT_NV21 || |
| (rotation == 0 && !flip_vert && !flip_horiz)); |
| TRACE_EVENT0("video", "VideoCaptureController::OnIncomingCapturedFrame"); |
| @@ -433,11 +434,22 @@ void VideoCaptureController::OnIncomingCapturedFrame( |
| data, yplane, vplane, uplane, frame_info_.width, frame_info_.height, |
| rotation, flip_vert, flip_horiz); |
| break; |
| - case media::PIXEL_FORMAT_NV21: |
| + case media::PIXEL_FORMAT_NV21: { |
| DCHECK(!chopped_width_ && !chopped_height_); |
| - media::ConvertNV21ToYUV(data, yplane, uplane, vplane, frame_info_.width, |
| - frame_info_.height); |
| + int num_pixels = frame_info_.width * frame_info_.height; |
| + media::ConvertNV21ToYUV( |
| + data, |
| + &i420_intermediate_buffer_[0], |
| + &i420_intermediate_buffer_[0] + num_pixels, |
|
tommi (sloooow) - chröme
2013/09/11 12:32:44
what's the difference between this and &i420_inter
|
| + &i420_intermediate_buffer_[0] + num_pixels * 5 / 4 , |
| + frame_info_.width, |
| + frame_info_.height); |
| + RotatePackedYV12Frame( |
| + &i420_intermediate_buffer_[0], yplane, uplane, vplane, |
| + frame_info_.width, frame_info_.height, |
| + rotation, flip_vert, flip_horiz); |
| break; |
| + } |
| case media::PIXEL_FORMAT_YUY2: |
| DCHECK(!chopped_width_ && !chopped_height_); |
| if (frame_info_.width * frame_info_.height * 2 != length) { |
| @@ -616,6 +628,11 @@ void VideoCaptureController::OnFrameInfo( |
| } else { |
| chopped_height_ = 0; |
| } |
| + if ((frame_info_.color == media::PIXEL_FORMAT_NV21) && |
| + (i420_intermediate_buffer_.get() == NULL)) { |
| + i420_intermediate_buffer_.reset( |
| + new uint8[frame_info_.width * frame_info_.height * 12 / 8]); |
| + } |
| BrowserThread::PostTask(BrowserThread::IO, |
| FROM_HERE, |
| base::Bind(&VideoCaptureController::DoFrameInfoOnIOThread, this)); |