Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: content/browser/renderer_host/media/video_capture_device_client.cc

Issue 2045813003: Decouple capture timestamp and reference time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/browser/renderer_host/media/video_capture_device_client.h" 5 #include "content/browser/renderer_host/media/video_capture_device_client.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 DCHECK_GE(static_cast<size_t>(length), frame_format.ImageAllocationSize()); 218 DCHECK_GE(static_cast<size_t>(length), frame_format.ImageAllocationSize());
219 219
220 if (external_jpeg_decoder_) { 220 if (external_jpeg_decoder_) {
221 const VideoCaptureGpuJpegDecoder::STATUS status = 221 const VideoCaptureGpuJpegDecoder::STATUS status =
222 external_jpeg_decoder_->GetStatus(); 222 external_jpeg_decoder_->GetStatus();
223 if (status == VideoCaptureGpuJpegDecoder::FAILED) { 223 if (status == VideoCaptureGpuJpegDecoder::FAILED) {
224 external_jpeg_decoder_.reset(); 224 external_jpeg_decoder_.reset();
225 } else if (status == VideoCaptureGpuJpegDecoder::INIT_PASSED && 225 } else if (status == VideoCaptureGpuJpegDecoder::INIT_PASSED &&
226 frame_format.pixel_format == media::PIXEL_FORMAT_MJPEG && 226 frame_format.pixel_format == media::PIXEL_FORMAT_MJPEG &&
227 rotation == 0 && !flip) { 227 rotation == 0 && !flip) {
228 // TODO(qiangchen): Pass timestamp into DecodeCapturedData. 228 external_jpeg_decoder_->DecodeCapturedData(data, length, frame_format,
229 external_jpeg_decoder_->DecodeCapturedData( 229 reference_time, timestamp,
230 data, length, frame_format, reference_time, std::move(buffer)); 230 std::move(buffer));
231 return; 231 return;
232 } 232 }
233 } 233 }
234 234
235 if (libyuv::ConvertToI420(data, 235 if (libyuv::ConvertToI420(data,
236 length, 236 length,
237 y_plane_data, 237 y_plane_data,
238 yplane_stride, 238 yplane_stride,
239 u_plane_data, 239 u_plane_data,
240 uv_plane_stride, 240 uv_plane_stride,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 return; 323 return;
324 frame->metadata()->SetDouble(media::VideoFrameMetadata::FRAME_RATE, 324 frame->metadata()->SetDouble(media::VideoFrameMetadata::FRAME_RATE,
325 frame_format.frame_rate); 325 frame_format.frame_rate);
326 OnIncomingCapturedVideoFrame(std::move(buffer), frame, reference_time); 326 OnIncomingCapturedVideoFrame(std::move(buffer), frame, reference_time);
327 } 327 }
328 328
329 void VideoCaptureDeviceClient::OnIncomingCapturedVideoFrame( 329 void VideoCaptureDeviceClient::OnIncomingCapturedVideoFrame(
330 std::unique_ptr<Buffer> buffer, 330 std::unique_ptr<Buffer> buffer,
331 const scoped_refptr<VideoFrame>& frame, 331 const scoped_refptr<VideoFrame>& frame,
332 base::TimeTicks reference_time) { 332 base::TimeTicks reference_time) {
333 // TODO(qiangchen): Dive into DoIncomingCapturedVideoFrameOnIOThread to
334 // process timestamp.
335 BrowserThread::PostTask( 333 BrowserThread::PostTask(
336 BrowserThread::IO, FROM_HERE, 334 BrowserThread::IO, FROM_HERE,
337 base::Bind( 335 base::Bind(
338 &VideoCaptureController::DoIncomingCapturedVideoFrameOnIOThread, 336 &VideoCaptureController::DoIncomingCapturedVideoFrameOnIOThread,
339 controller_, base::Passed(&buffer), frame, reference_time)); 337 controller_, base::Passed(&buffer), frame, reference_time));
340 } 338 }
341 339
342 std::unique_ptr<media::VideoCaptureDevice::Client::Buffer> 340 std::unique_ptr<media::VideoCaptureDevice::Client::Buffer>
343 VideoCaptureDeviceClient::ResurrectLastOutputBuffer( 341 VideoCaptureDeviceClient::ResurrectLastOutputBuffer(
344 const gfx::Size& dimensions, 342 const gfx::Size& dimensions,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 reinterpret_cast<uint8_t*>(buffer->data(VideoFrame::kUPlane)); 416 reinterpret_cast<uint8_t*>(buffer->data(VideoFrame::kUPlane));
419 *v_plane_data = 417 *v_plane_data =
420 reinterpret_cast<uint8_t*>(buffer->data(VideoFrame::kVPlane)); 418 reinterpret_cast<uint8_t*>(buffer->data(VideoFrame::kVPlane));
421 return buffer; 419 return buffer;
422 } 420 }
423 NOTREACHED(); 421 NOTREACHED();
424 return std::unique_ptr<Buffer>(); 422 return std::unique_ptr<Buffer>();
425 } 423 }
426 424
427 } // namespace content 425 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698