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

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..a8b1d4fb5d80a5f241949d9178d3b9301255d7f0 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:
@@ -449,8 +450,9 @@ void RTCVideoEncoder::Impl::RequireBitstreamBuffers(
}
void RTCVideoEncoder::Impl::BitstreamBufferReady(int32_t bitstream_buffer_id,
- size_t payload_size,
- bool key_frame) {
+ size_t payload_size,
+ 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();
Pawel Osciak 2016/05/23 07:15:52 Please remove this line and at l.489: image.captu
shenghao 2016/05/24 10:50:19 Done.
// Derive the capture time (in ms) and RTP timestamp (in 90KHz ticks).
const int64_t capture_time_ms = capture_time_us / 1000;
Pawel Osciak 2016/05/23 07:15:52 This could also be removed and l.480 modified acco
shenghao 2016/05/24 10:50:19 Done.
@@ -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()));
pbos 2016/05/20 12:15:51 This needs to copy over next_frame->timestamp(), n
shenghao 2016/05/24 10:50:19 Talked offline. We agreed to use ntp_time_ms()
if (!frame.get()) {
LogAndNotifyError(FROM_HERE, "failed to create frame",
media::VideoEncodeAccelerator::kPlatformFailureError);

Powered by Google App Engine
This is Rietveld 408576698