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

Unified Diff: webrtc/api/java/jni/androidvideocapturer_jni.cc

Issue 2017443003: Implement timestamp translation/filter in VideoCapturer. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add missing include of math.h. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/BUILD.gn ('k') | webrtc/base/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/java/jni/androidvideocapturer_jni.cc
diff --git a/webrtc/api/java/jni/androidvideocapturer_jni.cc b/webrtc/api/java/jni/androidvideocapturer_jni.cc
index 15cd2d4469dbb3387fecd62040d83f2d442704fc..37b4a22aef54d7631db93b97fb5fc5c1dc66012b 100644
--- a/webrtc/api/java/jni/androidvideocapturer_jni.cc
+++ b/webrtc/api/java/jni/androidvideocapturer_jni.cc
@@ -186,10 +186,14 @@ void AndroidVideoCapturerJni::OnMemoryBufferFrame(void* video_frame,
int crop_height;
int crop_x;
int crop_y;
+ int64_t translated_camera_time_us;
- if (!capturer_->AdaptFrame(width, height, timestamp_ns,
+ if (!capturer_->AdaptFrame(width, height,
+ timestamp_ns / rtc::kNumNanosecsPerMicrosec,
+ rtc::TimeMicros(),
&adapted_width, &adapted_height,
- &crop_width, &crop_height, &crop_x, &crop_y)) {
+ &crop_width, &crop_height, &crop_x, &crop_y,
+ &translated_camera_time_us)) {
return;
}
@@ -228,12 +232,12 @@ void AndroidVideoCapturerJni::OnMemoryBufferFrame(void* video_frame,
scaled_buffer->ScaleFrom(buffer);
buffer = scaled_buffer;
}
- // TODO(nisse): Use microsecond time instead.
capturer_->OnFrame(cricket::WebRtcVideoFrame(
- buffer, timestamp_ns,
+ buffer,
capturer_->apply_rotation()
? webrtc::kVideoRotation_0
- : static_cast<webrtc::VideoRotation>(rotation)),
+ : static_cast<webrtc::VideoRotation>(rotation),
+ translated_camera_time_us),
width, height);
}
@@ -256,10 +260,14 @@ void AndroidVideoCapturerJni::OnTextureFrame(int width,
int crop_height;
int crop_x;
int crop_y;
+ int64_t translated_camera_time_us;
- if (!capturer_->AdaptFrame(width, height, timestamp_ns,
+ if (!capturer_->AdaptFrame(width, height,
+ timestamp_ns / rtc::kNumNanosecsPerMicrosec,
+ rtc::TimeMicros(),
&adapted_width, &adapted_height,
- &crop_width, &crop_height, &crop_x, &crop_y)) {
+ &crop_width, &crop_height, &crop_x, &crop_y,
+ &translated_camera_time_us)) {
surface_texture_helper_->ReturnTextureFrame();
return;
}
@@ -279,15 +287,15 @@ void AndroidVideoCapturerJni::OnTextureFrame(int width,
matrix.Rotate(static_cast<webrtc::VideoRotation>(rotation));
}
- // TODO(nisse): Use microsecond time instead.
capturer_->OnFrame(
cricket::WebRtcVideoFrame(
surface_texture_helper_->CreateTextureFrame(
adapted_width, adapted_height,
NativeHandleImpl(handle.oes_texture_id, matrix)),
- timestamp_ns, capturer_->apply_rotation()
- ? webrtc::kVideoRotation_0
- : static_cast<webrtc::VideoRotation>(rotation)),
+ capturer_->apply_rotation()
+ ? webrtc::kVideoRotation_0
+ : static_cast<webrtc::VideoRotation>(rotation),
+ translated_camera_time_us),
width, height);
}
« no previous file with comments | « webrtc/BUILD.gn ('k') | webrtc/base/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698