Chromium Code Reviews| 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 b56fc7452502aa9ee0d9055bf6e918f9ebfa86c9..58e7202effb827510401cc0c188ca0c3a81512a3 100644 |
| --- a/media/capture/video/android/video_capture_device_android.cc |
| +++ b/media/capture/video/android/video_capture_device_android.cc |
| @@ -252,7 +252,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_) |
| @@ -272,7 +271,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/09/02 21:49:15
I'm pretty sure this could throw off consumers of
braveyao
2016/09/02 23:25:53
Done.
|
| } |
| env->ReleaseByteArrayElements(data, buffer, JNI_ABORT); |
| @@ -288,12 +287,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 int64_t absolute_micro = |
| + timestamp / base::Time::kNanosecondsPerMicrosecond; |
| + const base::TimeDelta capture_time = |
| + base::TimeDelta::FromMicroseconds(absolute_micro); |
| const base::TimeTicks current_time = base::TimeTicks::Now(); |
| { |
| @@ -301,7 +305,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_) |
| @@ -342,7 +345,7 @@ void VideoCaptureDeviceAndroid::OnI420FrameAvailable(JNIEnv* env, |
| return; |
| client_->OnIncomingCapturedData(buffer.get(), buffer_length, |
| capture_format_, rotation, current_time, |
| - current_time - first_ref_time_); |
| + capture_time); |
| } |
| } |