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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 return static_cast<VideoAnalyzer*>(obj)->PollStats(); | 380 return static_cast<VideoAnalyzer*>(obj)->PollStats(); |
381 } | 381 } |
382 | 382 |
383 bool PollStats() { | 383 bool PollStats() { |
384 if (done_.Wait(kSendStatsPollingIntervalMs)) | 384 if (done_.Wait(kSendStatsPollingIntervalMs)) |
385 return false; | 385 return false; |
386 | 386 |
387 VideoSendStream::Stats stats = send_stream_->GetStats(); | 387 VideoSendStream::Stats stats = send_stream_->GetStats(); |
388 | 388 |
389 rtc::CritScope crit(&comparison_lock_); | 389 rtc::CritScope crit(&comparison_lock_); |
390 encode_frame_rate_.AddSample(stats.encode_frame_rate); | 390 // It's not certain that we yet have estimates for any of these stats. Check |
391 encode_time_ms.AddSample(stats.avg_encode_time_ms); | 391 // that they are positive before mixing them in. |
392 encode_usage_percent.AddSample(stats.encode_usage_percent); | 392 if (stats.encode_frame_rate > 0) |
393 media_bitrate_bps.AddSample(stats.media_bitrate_bps); | 393 encode_frame_rate_.AddSample(stats.encode_frame_rate); |
| 394 if (stats.avg_encode_time_ms > 0) |
| 395 encode_time_ms.AddSample(stats.avg_encode_time_ms); |
| 396 if (stats.encode_usage_percent > 0) |
| 397 encode_usage_percent.AddSample(stats.encode_usage_percent); |
| 398 if (stats.media_bitrate_bps > 0) |
| 399 media_bitrate_bps.AddSample(stats.media_bitrate_bps); |
394 | 400 |
395 return true; | 401 return true; |
396 } | 402 } |
397 | 403 |
398 static bool FrameComparisonThread(void* obj) { | 404 static bool FrameComparisonThread(void* obj) { |
399 return static_cast<VideoAnalyzer*>(obj)->CompareFrames(); | 405 return static_cast<VideoAnalyzer*>(obj)->CompareFrames(); |
400 } | 406 } |
401 | 407 |
402 bool CompareFrames() { | 408 bool CompareFrames() { |
403 if (AllFramesRecorded()) | 409 if (AllFramesRecorded()) |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 video_send_stream_->Stop(); | 1093 video_send_stream_->Stop(); |
1088 receive_stream->Stop(); | 1094 receive_stream->Stop(); |
1089 | 1095 |
1090 call->DestroyVideoReceiveStream(receive_stream); | 1096 call->DestroyVideoReceiveStream(receive_stream); |
1091 call->DestroyVideoSendStream(video_send_stream_); | 1097 call->DestroyVideoSendStream(video_send_stream_); |
1092 | 1098 |
1093 transport.StopSending(); | 1099 transport.StopSending(); |
1094 } | 1100 } |
1095 | 1101 |
1096 } // namespace webrtc | 1102 } // namespace webrtc |
OLD | NEW |