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

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

Issue 2071953003: RtcVideoEncoder: use the current timestamp for encoded frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update the comment 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4ce16d53834017eb35d2ea0a9922398047144ef6..1dd8c693d46865576e82a05851a656e30e1f3021 100644
--- a/content/renderer/media/rtc_video_encoder.cc
+++ b/content/renderer/media/rtc_video_encoder.cc
@@ -456,7 +456,8 @@ void RTCVideoEncoder::Impl::BitstreamBufferReady(int32_t bitstream_buffer_id,
DVLOG(3) << "Impl::BitstreamBufferReady(): "
"bitstream_buffer_id=" << bitstream_buffer_id
<< ", payload_size=" << payload_size
- << ", key_frame=" << key_frame;
+ << ", key_frame=" << key_frame
+ << ", timestamp ms=" << timestamp.InMilliseconds();
DCHECK(thread_checker_.CalledOnValidThread());
if (bitstream_buffer_id < 0 ||
@@ -473,11 +474,16 @@ void RTCVideoEncoder::Impl::BitstreamBufferReady(int32_t bitstream_buffer_id,
}
output_buffers_free_count_--;
+ // CrOS Nyan provides invalid timestamp. Use the current time for now.
+ // TODO(wuchengli): use the timestamp in BitstreamBufferReady after Nyan is
+ // fixed.
mcasas 2016/06/17 10:32:42 Can you add a https://crbug.com/ to this comment f
wuchengli 2016/06/17 10:44:36 Done. PS1 has a http://crosbug.com/p/ bug. I just
+ const int64_t capture_time_us = rtc::TimeMicros();
+
// Derive the capture time (in ms) and RTP timestamp (in 90KHz ticks).
- // This is based on how input timestamps are calculated in
- // webrtc/video/video_capture_input.cc.
+ const int64_t capture_time_ms = capture_time_us / 1000;
mcasas 2016/06/17 10:32:42 s/1000/base::Time::kNanosecondsPerMicrosecond/ fro
wuchengli 2016/06/17 10:44:36 Done.
+
const uint32_t rtp_timestamp =
- static_cast<uint32_t>(timestamp.InMilliseconds()) * 90;
+ static_cast<uint32_t>(capture_time_us * 90 / 1000);
mcasas 2016/06/17 10:32:42 Same here
wuchengli 2016/06/17 10:44:36 Done.
webrtc::EncodedImage image(
reinterpret_cast<uint8_t*>(output_buffer->memory()), payload_size,
@@ -485,7 +491,7 @@ void RTCVideoEncoder::Impl::BitstreamBufferReady(int32_t bitstream_buffer_id,
image._encodedWidth = input_visible_size_.width();
image._encodedHeight = input_visible_size_.height();
image._timeStamp = rtp_timestamp;
- image.capture_time_ms_ = timestamp.InMilliseconds();
+ image.capture_time_ms_ = capture_time_ms;
image._frameType =
(key_frame ? webrtc::kVideoFrameKey : webrtc::kVideoFrameDelta);
image._completeFrame = true;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698