| 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..cb7752ba848c66bb1f0957f2e07e7267341824c0 100644
|
| --- a/content/renderer/media/rtc_video_encoder.cc
|
| +++ b/content/renderer/media/rtc_video_encoder.cc
|
| @@ -453,10 +453,10 @@ void RTCVideoEncoder::Impl::BitstreamBufferReady(int32_t bitstream_buffer_id,
|
| size_t payload_size,
|
| bool key_frame,
|
| base::TimeDelta timestamp) {
|
| - DVLOG(3) << "Impl::BitstreamBufferReady(): "
|
| - "bitstream_buffer_id=" << bitstream_buffer_id
|
| - << ", payload_size=" << payload_size
|
| - << ", key_frame=" << key_frame;
|
| + DVLOG(3) << "Impl::BitstreamBufferReady(): bitstream_buffer_id="
|
| + << bitstream_buffer_id << ", payload_size=" << payload_size
|
| + << ", key_frame=" << key_frame
|
| + << ", timestamp ms=" << timestamp.InMilliseconds();
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| if (bitstream_buffer_id < 0 ||
|
| @@ -473,11 +473,17 @@ 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. http://crbug.com/620565.
|
| + 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 uint32_t rtp_timestamp =
|
| - static_cast<uint32_t>(timestamp.InMilliseconds()) * 90;
|
| + const int64_t capture_time_ms =
|
| + capture_time_us / base::Time::kMicrosecondsPerMillisecond;
|
| +
|
| + const uint32_t rtp_timestamp = static_cast<uint32_t>(
|
| + capture_time_us * 90 / base::Time::kMicrosecondsPerMillisecond);
|
|
|
| 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;
|
|
|