| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 _codecDataBase(nullptr), | 49 _codecDataBase(nullptr), |
| 50 pre_decode_image_callback_(pre_decode_image_callback), | 50 pre_decode_image_callback_(pre_decode_image_callback), |
| 51 _receiveStatsTimer(1000, clock_), | 51 _receiveStatsTimer(1000, clock_), |
| 52 _retransmissionTimer(10, clock_), | 52 _retransmissionTimer(10, clock_), |
| 53 _keyRequestTimer(500, clock_) {} | 53 _keyRequestTimer(500, clock_) {} |
| 54 | 54 |
| 55 VideoReceiver::~VideoReceiver() {} | 55 VideoReceiver::~VideoReceiver() {} |
| 56 | 56 |
| 57 void VideoReceiver::Process() { | 57 void VideoReceiver::Process() { |
| 58 // Receive-side statistics | 58 // Receive-side statistics |
| 59 | |
| 60 // TODO(philipel): Remove this if block when we know what to do with | |
| 61 // ReceiveStatisticsProxy::QualitySample. | |
| 62 if (_receiveStatsTimer.TimeUntilProcess() == 0) { | 59 if (_receiveStatsTimer.TimeUntilProcess() == 0) { |
| 63 _receiveStatsTimer.Processed(); | 60 _receiveStatsTimer.Processed(); |
| 64 rtc::CritScope cs(&process_crit_); | 61 rtc::CritScope cs(&process_crit_); |
| 65 if (_receiveStatsCallback != nullptr) { | 62 if (_receiveStatsCallback != nullptr) { |
| 66 _receiveStatsCallback->OnReceiveRatesUpdated(0, 0); | 63 uint32_t bitRate; |
| 64 uint32_t frameRate; |
| 65 _receiver.ReceiveStatistics(&bitRate, &frameRate); |
| 66 _receiveStatsCallback->OnReceiveRatesUpdated(bitRate, frameRate); |
| 67 } |
| 68 |
| 69 if (_decoderTimingCallback != nullptr) { |
| 70 int decode_ms; |
| 71 int max_decode_ms; |
| 72 int current_delay_ms; |
| 73 int target_delay_ms; |
| 74 int jitter_buffer_ms; |
| 75 int min_playout_delay_ms; |
| 76 int render_delay_ms; |
| 77 if (_timing->GetTimings(&decode_ms, &max_decode_ms, ¤t_delay_ms, |
| 78 &target_delay_ms, &jitter_buffer_ms, |
| 79 &min_playout_delay_ms, &render_delay_ms)) { |
| 80 _decoderTimingCallback->OnDecoderTiming( |
| 81 decode_ms, max_decode_ms, current_delay_ms, target_delay_ms, |
| 82 jitter_buffer_ms, min_playout_delay_ms, render_delay_ms); |
| 83 } |
| 67 } | 84 } |
| 68 } | 85 } |
| 69 | 86 |
| 70 // Key frame requests | 87 // Key frame requests |
| 71 if (_keyRequestTimer.TimeUntilProcess() == 0) { | 88 if (_keyRequestTimer.TimeUntilProcess() == 0) { |
| 72 _keyRequestTimer.Processed(); | 89 _keyRequestTimer.Processed(); |
| 73 bool request_key_frame = false; | 90 bool request_key_frame = false; |
| 74 { | 91 { |
| 75 rtc::CritScope cs(&process_crit_); | 92 rtc::CritScope cs(&process_crit_); |
| 76 request_key_frame = _scheduleKeyRequest && _frameTypeCallback != nullptr; | 93 request_key_frame = _scheduleKeyRequest && _frameTypeCallback != nullptr; |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 LOG(LS_INFO) << "Received first " | 285 LOG(LS_INFO) << "Received first " |
| 269 << (frame->Complete() ? "complete" : "incomplete") | 286 << (frame->Complete() ? "complete" : "incomplete") |
| 270 << " decodable video frame"; | 287 << " decodable video frame"; |
| 271 } | 288 } |
| 272 | 289 |
| 273 const int32_t ret = Decode(*frame); | 290 const int32_t ret = Decode(*frame); |
| 274 _receiver.ReleaseFrame(frame); | 291 _receiver.ReleaseFrame(frame); |
| 275 return ret; | 292 return ret; |
| 276 } | 293 } |
| 277 | 294 |
| 278 // Used for the new jitter buffer. | 295 // Used for the WebRTC-NewVideoJitterBuffer experiment. |
| 279 // TODO(philipel): Clean up among the Decode functions as we replace | 296 // TODO(philipel): Clean up among the Decode functions as we replace |
| 280 // VCMEncodedFrame with FrameObject. | 297 // VCMEncodedFrame with FrameObject. |
| 281 int32_t VideoReceiver::Decode(const webrtc::VCMEncodedFrame* frame) { | 298 int32_t VideoReceiver::Decode(const webrtc::VCMEncodedFrame* frame) { |
| 282 rtc::CritScope lock(&receive_crit_); | 299 rtc::CritScope lock(&receive_crit_); |
| 283 if (pre_decode_image_callback_) { | 300 if (pre_decode_image_callback_) { |
| 284 EncodedImage encoded_image(frame->EncodedImage()); | 301 EncodedImage encoded_image(frame->EncodedImage()); |
| 285 int qp = -1; | 302 int qp = -1; |
| 286 if (qp_parser_.GetQp(*frame, &qp)) { | 303 if (qp_parser_.GetQp(*frame, &qp)) { |
| 287 encoded_image.qp_ = qp; | 304 encoded_image.qp_ = qp; |
| 288 } | 305 } |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 _receiver.SetNackSettings(max_nack_list_size, max_packet_age_to_nack, | 515 _receiver.SetNackSettings(max_nack_list_size, max_packet_age_to_nack, |
| 499 max_incomplete_time_ms); | 516 max_incomplete_time_ms); |
| 500 } | 517 } |
| 501 | 518 |
| 502 int VideoReceiver::SetMinReceiverDelay(int desired_delay_ms) { | 519 int VideoReceiver::SetMinReceiverDelay(int desired_delay_ms) { |
| 503 return _receiver.SetMinReceiverDelay(desired_delay_ms); | 520 return _receiver.SetMinReceiverDelay(desired_delay_ms); |
| 504 } | 521 } |
| 505 | 522 |
| 506 } // namespace vcm | 523 } // namespace vcm |
| 507 } // namespace webrtc | 524 } // namespace webrtc |
| OLD | NEW |