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

Unified Diff: media/capture/video/android/video_capture_device_android.cc

Issue 2272873002: Android video capture: only use reference time for outbound timestamp. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use raw timestamp from camera capture Created 4 years, 4 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: media/capture/video/android/video_capture_device_android.cc
diff --git a/media/capture/video/android/video_capture_device_android.cc b/media/capture/video/android/video_capture_device_android.cc
index b3c5d89f19f7626cdb8884c9f2dcb42224a8312b..de6dd362150632e38a454e1093198f7593d371c2 100644
--- a/media/capture/video/android/video_capture_device_android.cc
+++ b/media/capture/video/android/video_capture_device_android.cc
@@ -214,7 +214,6 @@ void VideoCaptureDeviceAndroid::OnFrameAvailable(
if (!got_first_frame_) {
// Set aside one frame allowance for fluctuation.
expected_next_frame_time_ = current_time - frame_interval_;
- first_ref_time_ = current_time;
got_first_frame_ = true;
for (const auto& request : photo_requests_queue_)
@@ -234,7 +233,7 @@ void VideoCaptureDeviceAndroid::OnFrameAvailable(
return;
client_->OnIncomingCapturedData(reinterpret_cast<uint8_t*>(buffer), length,
capture_format_, rotation, current_time,
- current_time - first_ref_time_);
+ base::TimeDelta());
miu 2016/08/31 21:09:16 Please plumb-in timestamp here too.
braveyao 2016/08/31 23:01:28 No capture timestamp available here. Maybe better
}
env->ReleaseByteArrayElements(data, buffer, JNI_ABORT);
@@ -250,12 +249,17 @@ void VideoCaptureDeviceAndroid::OnI420FrameAvailable(JNIEnv* env,
jint uv_pixel_stride,
jint width,
jint height,
- jint rotation) {
+ jint rotation,
+ jlong timestamp) {
{
base::AutoLock lock(lock_);
if (state_ != kConfigured || !client_)
return;
}
+ const uint64_t absolute_micro =
miu 2016/08/31 21:09:16 nit: Should be int64_t since both operands are sig
braveyao 2016/08/31 23:01:28 Done.
+ timestamp / base::Time::kNanosecondsPerMicrosecond;
+ const base::TimeDelta start_time =
miu 2016/08/31 21:09:16 naming nit: How about |capture_time|? According to
braveyao 2016/08/31 23:01:28 Done.
+ base::TimeDelta::FromMicroseconds(absolute_micro);
const base::TimeTicks current_time = base::TimeTicks::Now();
{
@@ -263,7 +267,6 @@ void VideoCaptureDeviceAndroid::OnI420FrameAvailable(JNIEnv* env,
if (!got_first_frame_) {
// Set aside one frame allowance for fluctuation.
expected_next_frame_time_ = current_time - frame_interval_;
- first_ref_time_ = current_time;
got_first_frame_ = true;
for (const auto& request : photo_requests_queue_)
@@ -304,7 +307,7 @@ void VideoCaptureDeviceAndroid::OnI420FrameAvailable(JNIEnv* env,
return;
client_->OnIncomingCapturedData(buffer.get(), buffer_length,
capture_format_, rotation, current_time,
- current_time - first_ref_time_);
+ start_time);
}
}

Powered by Google App Engine
This is Rietveld 408576698