| 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 "webrtc/video/video_quality_test.h" | 10 #include "webrtc/video/video_quality_test.h" |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 render_time_ms, encoded_size)); | 548 render_time_ms, encoded_size)); |
| 549 } else { | 549 } else { |
| 550 comparisons_.push_back(FrameComparison(dropped, | 550 comparisons_.push_back(FrameComparison(dropped, |
| 551 reference.ntp_time_ms(), | 551 reference.ntp_time_ms(), |
| 552 send_time_ms, recv_time_ms, | 552 send_time_ms, recv_time_ms, |
| 553 render_time_ms, encoded_size)); | 553 render_time_ms, encoded_size)); |
| 554 } | 554 } |
| 555 comparison_available_event_.Set(); | 555 comparison_available_event_.Set(); |
| 556 } | 556 } |
| 557 | 557 |
| 558 static bool PollStatsThread(void* obj) { | 558 static void PollStatsThread(void* obj) { |
| 559 return static_cast<VideoAnalyzer*>(obj)->PollStats(); | 559 static_cast<VideoAnalyzer*>(obj)->PollStats(); |
| 560 } | 560 } |
| 561 | 561 |
| 562 bool PollStats() { | 562 void PollStats() { |
| 563 if (done_.Wait(kSendStatsPollingIntervalMs)) | 563 while (!done_.Wait(kSendStatsPollingIntervalMs)) { |
| 564 return false; | 564 rtc::CritScope crit(&comparison_lock_); |
| 565 | 565 |
| 566 rtc::CritScope crit(&comparison_lock_); | 566 VideoSendStream::Stats send_stats = send_stream_->GetStats(); |
| 567 // It's not certain that we yet have estimates for any of these stats. |
| 568 // Check that they are positive before mixing them in. |
| 569 if (send_stats.encode_frame_rate > 0) |
| 570 encode_frame_rate_.AddSample(send_stats.encode_frame_rate); |
| 571 if (send_stats.avg_encode_time_ms > 0) |
| 572 encode_time_ms_.AddSample(send_stats.avg_encode_time_ms); |
| 573 if (send_stats.encode_usage_percent > 0) |
| 574 encode_usage_percent_.AddSample(send_stats.encode_usage_percent); |
| 575 if (send_stats.media_bitrate_bps > 0) |
| 576 media_bitrate_bps_.AddSample(send_stats.media_bitrate_bps); |
| 567 | 577 |
| 568 VideoSendStream::Stats send_stats = send_stream_->GetStats(); | 578 if (receive_stream_ != nullptr) { |
| 569 // It's not certain that we yet have estimates for any of these stats. Check | 579 VideoReceiveStream::Stats receive_stats = receive_stream_->GetStats(); |
| 570 // that they are positive before mixing them in. | 580 if (receive_stats.decode_ms > 0) |
| 571 if (send_stats.encode_frame_rate > 0) | 581 decode_time_ms_.AddSample(receive_stats.decode_ms); |
| 572 encode_frame_rate_.AddSample(send_stats.encode_frame_rate); | 582 if (receive_stats.max_decode_ms > 0) |
| 573 if (send_stats.avg_encode_time_ms > 0) | 583 decode_time_max_ms_.AddSample(receive_stats.max_decode_ms); |
| 574 encode_time_ms_.AddSample(send_stats.avg_encode_time_ms); | 584 } |
| 575 if (send_stats.encode_usage_percent > 0) | |
| 576 encode_usage_percent_.AddSample(send_stats.encode_usage_percent); | |
| 577 if (send_stats.media_bitrate_bps > 0) | |
| 578 media_bitrate_bps_.AddSample(send_stats.media_bitrate_bps); | |
| 579 | |
| 580 if (receive_stream_ != nullptr) { | |
| 581 VideoReceiveStream::Stats receive_stats = receive_stream_->GetStats(); | |
| 582 if (receive_stats.decode_ms > 0) | |
| 583 decode_time_ms_.AddSample(receive_stats.decode_ms); | |
| 584 if (receive_stats.max_decode_ms > 0) | |
| 585 decode_time_max_ms_.AddSample(receive_stats.max_decode_ms); | |
| 586 } | 585 } |
| 587 | |
| 588 return true; | |
| 589 } | 586 } |
| 590 | 587 |
| 591 static bool FrameComparisonThread(void* obj) { | 588 static bool FrameComparisonThread(void* obj) { |
| 592 return static_cast<VideoAnalyzer*>(obj)->CompareFrames(); | 589 return static_cast<VideoAnalyzer*>(obj)->CompareFrames(); |
| 593 } | 590 } |
| 594 | 591 |
| 595 bool CompareFrames() { | 592 bool CompareFrames() { |
| 596 if (AllFramesRecorded()) | 593 if (AllFramesRecorded()) |
| 597 return false; | 594 return false; |
| 598 | 595 |
| (...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1604 std::ostringstream str; | 1601 std::ostringstream str; |
| 1605 str << receive_logs_++; | 1602 str << receive_logs_++; |
| 1606 std::string path = | 1603 std::string path = |
| 1607 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; | 1604 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; |
| 1608 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), | 1605 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), |
| 1609 10000000); | 1606 10000000); |
| 1610 } | 1607 } |
| 1611 } | 1608 } |
| 1612 | 1609 |
| 1613 } // namespace webrtc | 1610 } // namespace webrtc |
| OLD | NEW |