Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 delete thread; | 111 delete thread; |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 | 114 |
| 115 virtual void SetReceiver(PacketReceiver* receiver) { receiver_ = receiver; } | 115 virtual void SetReceiver(PacketReceiver* receiver) { receiver_ = receiver; } |
| 116 | 116 |
| 117 DeliveryStatus DeliverPacket(MediaType media_type, | 117 DeliveryStatus DeliverPacket(MediaType media_type, |
| 118 const uint8_t* packet, | 118 const uint8_t* packet, |
| 119 size_t length, | 119 size_t length, |
| 120 const PacketTime& packet_time) override { | 120 const PacketTime& packet_time) override { |
| 121 // Ignore timestamps of RTCP packets. They're not synchronized with | |
| 122 // RTP packet timestamps and so they would confuse wrap_handler_. | |
| 123 if (RtpHeaderParser::IsRtcp(packet, length)) { | |
| 124 return receiver_->DeliverPacket(media_type, packet, length, packet_time); | |
| 125 } | |
| 126 | |
|
sprang_webrtc
2016/03/18 10:05:29
Thinking some more about this, perhaps we should e
| |
| 121 RtpUtility::RtpHeaderParser parser(packet, length); | 127 RtpUtility::RtpHeaderParser parser(packet, length); |
| 122 RTPHeader header; | 128 RTPHeader header; |
| 123 parser.Parse(&header); | 129 parser.Parse(&header); |
| 124 { | 130 { |
| 125 rtc::CritScope lock(&crit_); | 131 rtc::CritScope lock(&crit_); |
| 126 int64_t timestamp = | 132 int64_t timestamp = |
| 127 wrap_handler_.Unwrap(header.timestamp - rtp_timestamp_delta_); | 133 wrap_handler_.Unwrap(header.timestamp - rtp_timestamp_delta_); |
| 128 recv_times_[timestamp] = | 134 recv_times_[timestamp] = |
| 129 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds(); | 135 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds(); |
| 130 } | 136 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 if (frames_recorded_ < frames_to_process_) | 204 if (frames_recorded_ < frames_to_process_) |
| 199 encoded_frame_size_.AddSample(frame.length_); | 205 encoded_frame_size_.AddSample(frame.length_); |
| 200 } | 206 } |
| 201 | 207 |
| 202 void RenderFrame(const VideoFrame& video_frame, | 208 void RenderFrame(const VideoFrame& video_frame, |
| 203 int time_to_render_ms) override { | 209 int time_to_render_ms) override { |
| 204 int64_t render_time_ms = | 210 int64_t render_time_ms = |
| 205 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds(); | 211 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds(); |
| 206 | 212 |
| 207 rtc::CritScope lock(&crit_); | 213 rtc::CritScope lock(&crit_); |
| 208 uint32_t send_timestamp = | 214 int64_t send_timestamp = |
| 209 wrap_handler_.Unwrap(video_frame.timestamp() - rtp_timestamp_delta_); | 215 wrap_handler_.Unwrap(video_frame.timestamp() - rtp_timestamp_delta_); |
| 210 | 216 |
| 211 while (wrap_handler_.Unwrap(frames_.front().timestamp()) < send_timestamp) { | 217 while (wrap_handler_.Unwrap(frames_.front().timestamp()) < send_timestamp) { |
| 212 if (last_rendered_frame_.IsZeroSize()) { | 218 if (last_rendered_frame_.IsZeroSize()) { |
| 213 // No previous frame rendered, this one was dropped after sending but | 219 // No previous frame rendered, this one was dropped after sending but |
| 214 // before rendering. | 220 // before rendering. |
| 215 ++dropped_frames_before_rendering_; | 221 ++dropped_frames_before_rendering_; |
| 216 frames_.pop_front(); | 222 frames_.pop_front(); |
| 217 RTC_CHECK(!frames_.empty()); | 223 RTC_CHECK(!frames_.empty()); |
| 218 continue; | 224 continue; |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1124 video_send_stream_->Stop(); | 1130 video_send_stream_->Stop(); |
| 1125 receive_stream->Stop(); | 1131 receive_stream->Stop(); |
| 1126 | 1132 |
| 1127 call->DestroyVideoReceiveStream(receive_stream); | 1133 call->DestroyVideoReceiveStream(receive_stream); |
| 1128 call->DestroyVideoSendStream(video_send_stream_); | 1134 call->DestroyVideoSendStream(video_send_stream_); |
| 1129 | 1135 |
| 1130 transport.StopSending(); | 1136 transport.StopSending(); |
| 1131 } | 1137 } |
| 1132 | 1138 |
| 1133 } // namespace webrtc | 1139 } // namespace webrtc |
| OLD | NEW |