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

Unified Diff: content/browser/renderer_host/media/video_capture_device_client.cc

Issue 1983193002: Decouple capture timestamp and reference time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change OnIncomingCapturedBuffer Sig Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/video_capture_device_client.cc
diff --git a/content/browser/renderer_host/media/video_capture_device_client.cc b/content/browser/renderer_host/media/video_capture_device_client.cc
index cf6ad3a98149ed256c83dce37eb3a833c8426cf4..974be109fe7ff895df5008e3a4ad6e93c0ee3e2f 100644
--- a/content/browser/renderer_host/media/video_capture_device_client.cc
+++ b/content/browser/renderer_host/media/video_capture_device_client.cc
@@ -85,7 +85,8 @@ void VideoCaptureDeviceClient::OnIncomingCapturedData(
int length,
const VideoCaptureFormat& frame_format,
int rotation,
- const base::TimeTicks& timestamp) {
+ base::TimeTicks reference_time,
+ base::TimeDelta timestamp) {
TRACE_EVENT0("video", "VideoCaptureDeviceClient::OnIncomingCapturedData");
DCHECK_EQ(media::PIXEL_STORAGE_CPU, frame_format.pixel_storage);
@@ -224,8 +225,9 @@ void VideoCaptureDeviceClient::OnIncomingCapturedData(
} else if (status == VideoCaptureGpuJpegDecoder::INIT_PASSED &&
frame_format.pixel_format == media::PIXEL_FORMAT_MJPEG &&
rotation == 0 && !flip) {
- external_jpeg_decoder_->DecodeCapturedData(data, length, frame_format,
- timestamp, std::move(buffer));
+ // TODO(qiangchen): Pass timestamp into DecodeCapturedData.
+ external_jpeg_decoder_->DecodeCapturedData(
+ data, length, frame_format, reference_time, std::move(buffer));
return;
}
}
@@ -254,7 +256,8 @@ void VideoCaptureDeviceClient::OnIncomingCapturedData(
const VideoCaptureFormat output_format = VideoCaptureFormat(
dimensions, frame_format.frame_rate,
media::PIXEL_FORMAT_I420, output_pixel_storage);
- OnIncomingCapturedBuffer(std::move(buffer), output_format, timestamp);
+ OnIncomingCapturedBuffer(std::move(buffer), output_format, reference_time,
+ timestamp);
}
std::unique_ptr<media::VideoCaptureDevice::Client::Buffer>
@@ -287,7 +290,8 @@ VideoCaptureDeviceClient::ReserveOutputBuffer(
void VideoCaptureDeviceClient::OnIncomingCapturedBuffer(
std::unique_ptr<Buffer> buffer,
const VideoCaptureFormat& frame_format,
- const base::TimeTicks& timestamp) {
+ base::TimeTicks reference_time,
+ base::TimeDelta timestamp) {
// Currently, only I420 pixel format is supported.
DCHECK_EQ(media::PIXEL_FORMAT_I420, frame_format.pixel_format);
@@ -319,22 +323,21 @@ void VideoCaptureDeviceClient::OnIncomingCapturedBuffer(
return;
frame->metadata()->SetDouble(media::VideoFrameMetadata::FRAME_RATE,
frame_format.frame_rate);
- OnIncomingCapturedVideoFrame(std::move(buffer), frame, timestamp);
+ frame->set_timestamp(timestamp);
miu 2016/05/25 01:51:30 nit: Instead of calling set_timestamp() here, you
qiangchen 2016/05/25 16:46:17 Done.
+ OnIncomingCapturedVideoFrame(std::move(buffer), frame, reference_time);
}
void VideoCaptureDeviceClient::OnIncomingCapturedVideoFrame(
std::unique_ptr<Buffer> buffer,
const scoped_refptr<VideoFrame>& frame,
- const base::TimeTicks& timestamp) {
+ base::TimeTicks reference_time) {
+ // TODO(qiangchen): Dive into DoIncomingCapturedVideoFrameOnIOThread to
+ // process timestamp.
BrowserThread::PostTask(
- BrowserThread::IO,
- FROM_HERE,
+ BrowserThread::IO, FROM_HERE,
base::Bind(
&VideoCaptureController::DoIncomingCapturedVideoFrameOnIOThread,
- controller_,
- base::Passed(&buffer),
- frame,
- timestamp));
+ controller_, base::Passed(&buffer), frame, reference_time));
}
std::unique_ptr<media::VideoCaptureDevice::Client::Buffer>

Powered by Google App Engine
This is Rietveld 408576698