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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 RTC_DCHECK_EQ(res, video_coding::FrameBuffer::ReturnReason::kTimeout); | 521 RTC_DCHECK_EQ(res, video_coding::FrameBuffer::ReturnReason::kTimeout); |
522 int64_t now_ms = clock_->TimeInMilliseconds(); | 522 int64_t now_ms = clock_->TimeInMilliseconds(); |
523 rtc::Optional<int64_t> last_packet_ms = | 523 rtc::Optional<int64_t> last_packet_ms = |
524 rtp_video_stream_receiver_.LastReceivedPacketMs(); | 524 rtp_video_stream_receiver_.LastReceivedPacketMs(); |
525 rtc::Optional<int64_t> last_keyframe_packet_ms = | 525 rtc::Optional<int64_t> last_keyframe_packet_ms = |
526 rtp_video_stream_receiver_.LastReceivedKeyframePacketMs(); | 526 rtp_video_stream_receiver_.LastReceivedKeyframePacketMs(); |
527 | 527 |
528 // To avoid spamming keyframe requests for a stream that is not active we | 528 // To avoid spamming keyframe requests for a stream that is not active we |
529 // check if we have received a packet within the last 5 seconds. | 529 // check if we have received a packet within the last 5 seconds. |
530 bool stream_is_active = last_packet_ms && now_ms - *last_packet_ms < 5000; | 530 bool stream_is_active = last_packet_ms && now_ms - *last_packet_ms < 5000; |
| 531 if (!stream_is_active) |
| 532 stats_proxy_.OnStreamInactive(); |
531 | 533 |
532 // If we recently have been receiving packets belonging to a keyframe then | 534 // If we recently have been receiving packets belonging to a keyframe then |
533 // we assume a keyframe is currently being received. | 535 // we assume a keyframe is currently being received. |
534 bool receiving_keyframe = | 536 bool receiving_keyframe = |
535 last_keyframe_packet_ms && | 537 last_keyframe_packet_ms && |
536 now_ms - *last_keyframe_packet_ms < kMaxWaitForKeyFrameMs; | 538 now_ms - *last_keyframe_packet_ms < kMaxWaitForKeyFrameMs; |
537 | 539 |
538 if (stream_is_active && !receiving_keyframe) { | 540 if (stream_is_active && !receiving_keyframe) { |
539 LOG(LS_WARNING) << "No decodable frame in " << wait_ms | 541 LOG(LS_WARNING) << "No decodable frame in " << wait_ms |
540 << " ms, requesting keyframe."; | 542 << " ms, requesting keyframe."; |
541 RequestKeyFrame(); | 543 RequestKeyFrame(); |
542 } | 544 } |
543 } | 545 } |
544 return true; | 546 return true; |
545 } | 547 } |
546 } // namespace internal | 548 } // namespace internal |
547 } // namespace webrtc | 549 } // namespace webrtc |
OLD | NEW |