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

Unified Diff: content/renderer/media/rtc_video_encoder.cc

Issue 1996453003: RTC Video Encoder: Use capturer timestamp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/renderer/media/rtc_video_encoder.cc
diff --git a/content/renderer/media/rtc_video_encoder.cc b/content/renderer/media/rtc_video_encoder.cc
index 103e0c102b07a0413ffd35ffe174ec67e688bc1d..f2a80ad76896b0bf670356dd6872b8b0e0f2feda 100644
--- a/content/renderer/media/rtc_video_encoder.cc
+++ b/content/renderer/media/rtc_video_encoder.cc
@@ -149,7 +149,8 @@ class RTCVideoEncoder::Impl
size_t output_buffer_size) override;
void BitstreamBufferReady(int32_t bitstream_buffer_id,
size_t payload_size,
- bool key_frame) override;
+ bool key_frame,
+ base::TimeDelta timestamp) override;
void NotifyError(media::VideoEncodeAccelerator::Error error) override;
private:
@@ -450,7 +451,8 @@ void RTCVideoEncoder::Impl::RequireBitstreamBuffers(
void RTCVideoEncoder::Impl::BitstreamBufferReady(int32_t bitstream_buffer_id,
size_t payload_size,
- bool key_frame) {
+ bool key_frame,
+ base::TimeDelta timestamp) {
DVLOG(3) << "Impl::BitstreamBufferReady(): "
"bitstream_buffer_id=" << bitstream_buffer_id
<< ", payload_size=" << payload_size
@@ -471,9 +473,7 @@ void RTCVideoEncoder::Impl::BitstreamBufferReady(int32_t bitstream_buffer_id,
}
output_buffers_free_count_--;
- // Use webrtc timestamps to ensure correct RTP sender behavior.
- // TODO(hshi): obtain timestamp from the capturer, see crbug.com/350106.
- const int64_t capture_time_us = rtc::TimeMicros();
+ const int64_t capture_time_us = timestamp.InMicroseconds();
// Derive the capture time (in ms) and RTP timestamp (in 90KHz ticks).
const int64_t capture_time_ms = capture_time_us / 1000;
@@ -568,7 +568,7 @@ void RTCVideoEncoder::Impl::EncodeOneFrame() {
gfx::Rect(input_visible_size_), input_visible_size_,
reinterpret_cast<uint8_t*>(input_buffer->memory()),
input_buffer->mapped_size(), input_buffer->handle(), 0,
- base::TimeDelta());
+ base::TimeDelta::FromMilliseconds(next_frame->ntp_time_ms()));
if (!frame.get()) {
LogAndNotifyError(FROM_HERE, "failed to create frame",
media::VideoEncodeAccelerator::kPlatformFailureError);
« no previous file with comments | « no previous file | content/renderer/pepper/pepper_video_encoder_host.h » ('j') | content/renderer/pepper/video_encoder_shim.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698