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 ae10a6fac48df764618afeb6151c20cf21390969..c2eeb58e667db35b80fd013f48d02a7932b152e1 100644 |
--- a/content/browser/renderer_host/media/video_capture_controller.cc |
+++ b/content/browser/renderer_host/media/video_capture_controller.cc |
@@ -400,6 +400,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"); |
@@ -437,11 +438,21 @@ 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, |
+ int num_pixels = frame_info_.width * frame_info_.height; |
+ media::ConvertNV21ToYUV(data, |
+ &i420_intermediate_buffer_[0], |
+ &i420_intermediate_buffer_[num_pixels], |
+ &i420_intermediate_buffer_[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) { |
@@ -620,6 +631,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( |
scherkus (not reviewing)
2013/09/12 17:26:49
does this mean we're allocating memory for i420_in
mcasas
2013/09/13 08:42:51
I should guard it with the #ifdef - sigh.
mcasas
2013/09/16 08:43:02
Done.
|
+ new uint8[frame_info_.width * frame_info_.height * 12 / 8]); |
+ } |
BrowserThread::PostTask(BrowserThread::IO, |
FROM_HERE, |
base::Bind(&VideoCaptureController::DoFrameInfoOnIOThread, this)); |