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. |
59 if (_receiveStatsTimer.TimeUntilProcess() == 0) { | 62 if (_receiveStatsTimer.TimeUntilProcess() == 0) { |
60 _receiveStatsTimer.Processed(); | 63 _receiveStatsTimer.Processed(); |
61 rtc::CritScope cs(&process_crit_); | 64 rtc::CritScope cs(&process_crit_); |
62 if (_receiveStatsCallback != nullptr) { | 65 if (_receiveStatsCallback != nullptr) { |
63 uint32_t bitRate; | 66 _receiveStatsCallback->OnReceiveRatesUpdated(0, 0); |
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 } | |
84 } | 67 } |
85 } | 68 } |
86 | 69 |
87 // Key frame requests | 70 // Key frame requests |
88 if (_keyRequestTimer.TimeUntilProcess() == 0) { | 71 if (_keyRequestTimer.TimeUntilProcess() == 0) { |
89 _keyRequestTimer.Processed(); | 72 _keyRequestTimer.Processed(); |
90 bool request_key_frame = false; | 73 bool request_key_frame = false; |
91 { | 74 { |
92 rtc::CritScope cs(&process_crit_); | 75 rtc::CritScope cs(&process_crit_); |
93 request_key_frame = _scheduleKeyRequest && _frameTypeCallback != nullptr; | 76 request_key_frame = _scheduleKeyRequest && _frameTypeCallback != nullptr; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 LOG(LS_INFO) << "Received first " | 268 LOG(LS_INFO) << "Received first " |
286 << (frame->Complete() ? "complete" : "incomplete") | 269 << (frame->Complete() ? "complete" : "incomplete") |
287 << " decodable video frame"; | 270 << " decodable video frame"; |
288 } | 271 } |
289 | 272 |
290 const int32_t ret = Decode(*frame); | 273 const int32_t ret = Decode(*frame); |
291 _receiver.ReleaseFrame(frame); | 274 _receiver.ReleaseFrame(frame); |
292 return ret; | 275 return ret; |
293 } | 276 } |
294 | 277 |
295 // Used for the WebRTC-NewVideoJitterBuffer experiment. | 278 // Used for the new jitter buffer. |
296 // TODO(philipel): Clean up among the Decode functions as we replace | 279 // TODO(philipel): Clean up among the Decode functions as we replace |
297 // VCMEncodedFrame with FrameObject. | 280 // VCMEncodedFrame with FrameObject. |
298 int32_t VideoReceiver::Decode(const webrtc::VCMEncodedFrame* frame) { | 281 int32_t VideoReceiver::Decode(const webrtc::VCMEncodedFrame* frame) { |
299 rtc::CritScope lock(&receive_crit_); | 282 rtc::CritScope lock(&receive_crit_); |
300 if (pre_decode_image_callback_) { | 283 if (pre_decode_image_callback_) { |
301 EncodedImage encoded_image(frame->EncodedImage()); | 284 EncodedImage encoded_image(frame->EncodedImage()); |
302 int qp = -1; | 285 int qp = -1; |
303 if (qp_parser_.GetQp(*frame, &qp)) { | 286 if (qp_parser_.GetQp(*frame, &qp)) { |
304 encoded_image.qp_ = qp; | 287 encoded_image.qp_ = qp; |
305 } | 288 } |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 _receiver.SetNackSettings(max_nack_list_size, max_packet_age_to_nack, | 498 _receiver.SetNackSettings(max_nack_list_size, max_packet_age_to_nack, |
516 max_incomplete_time_ms); | 499 max_incomplete_time_ms); |
517 } | 500 } |
518 | 501 |
519 int VideoReceiver::SetMinReceiverDelay(int desired_delay_ms) { | 502 int VideoReceiver::SetMinReceiverDelay(int desired_delay_ms) { |
520 return _receiver.SetMinReceiverDelay(desired_delay_ms); | 503 return _receiver.SetMinReceiverDelay(desired_delay_ms); |
521 } | 504 } |
522 | 505 |
523 } // namespace vcm | 506 } // namespace vcm |
524 } // namespace webrtc | 507 } // namespace webrtc |
OLD | NEW |