diff --git a/test/scenario/quality_stats.cc b/test/scenario/quality_stats.cc index 4a425825c8..0391fe0e06 100644 --- a/test/scenario/quality_stats.cc +++ b/test/scenario/quality_stats.cc @@ -40,8 +40,6 @@ VideoQualityAnalyzer::~VideoQualityAnalyzer() { void VideoQualityAnalyzer::OnCapturedFrame(const VideoFrame& frame) { VideoFrame copy = frame; task_queue_.PostTask([this, copy]() mutable { - if (!first_capture_ntp_time_ms_) - first_capture_ntp_time_ms_ = copy.ntp_time_ms(); captured_frames_.push_back(std::move(copy)); }); } @@ -51,33 +49,10 @@ void VideoQualityAnalyzer::OnDecodedFrame(const VideoFrame& frame) { RTC_CHECK(frame.ntp_time_ms()); RTC_CHECK(frame.timestamp()); task_queue_.PostTask([this, decoded] { - // If first frame never is received, this value will be wrong. However, that - // is something that is very unlikely to happen. - if (!first_decode_rtp_timestamp_) - first_decode_rtp_timestamp_ = decoded.timestamp(); + // TODO(srte): Add detection and handling of lost frames. RTC_CHECK(!captured_frames_.empty()); - int64_t decoded_capture_time_ms = DecodedFrameCaptureTimeOffsetMs(decoded); - while (CapturedFrameCaptureTimeOffsetMs(captured_frames_.front()) < - decoded_capture_time_ms) { - VideoFrame lost = std::move(captured_frames_.front()); - captured_frames_.pop_front(); - VideoFrameQualityInfo lost_info = - VideoFrameQualityInfo{Timestamp::us(lost.timestamp_us()), - Timestamp::PlusInfinity(), - Timestamp::PlusInfinity(), - lost.width(), - lost.height(), - NAN}; - for (auto& handler : frame_info_handlers_) - handler(lost_info); - RTC_CHECK(!captured_frames_.empty()); - } - RTC_CHECK(!captured_frames_.empty()); - RTC_CHECK(CapturedFrameCaptureTimeOffsetMs(captured_frames_.front()) == - DecodedFrameCaptureTimeOffsetMs(decoded)); VideoFrame captured = std::move(captured_frames_.front()); captured_frames_.pop_front(); - VideoFrameQualityInfo decoded_info = VideoFrameQualityInfo{Timestamp::us(captured.timestamp_us()), Timestamp::ms(decoded.timestamp() / 90.0), @@ -94,21 +69,6 @@ bool VideoQualityAnalyzer::Active() const { return !frame_info_handlers_.empty(); } -int64_t VideoQualityAnalyzer::DecodedFrameCaptureTimeOffsetMs( - const VideoFrame& decoded) const { - // Assumes that the underlying resolution is ms. - // Note that we intentinally allow wraparound. The code is incorrect for - // durations of more than UINT32_MAX/90 ms. - RTC_DCHECK(first_decode_rtp_timestamp_); - return (decoded.timestamp() - *first_decode_rtp_timestamp_) / 90; -} - -int64_t VideoQualityAnalyzer::CapturedFrameCaptureTimeOffsetMs( - const VideoFrame& captured) const { - RTC_DCHECK(first_capture_ntp_time_ms_); - return captured.ntp_time_ms() - *first_capture_ntp_time_ms_; -} - void VideoQualityAnalyzer::PrintHeaders() { writer_->Write("capt recv_capt render width height psnr\n"); } diff --git a/test/scenario/quality_stats.h b/test/scenario/quality_stats.h index ece995cd6d..0bfd96e9bc 100644 --- a/test/scenario/quality_stats.h +++ b/test/scenario/quality_stats.h @@ -44,16 +44,12 @@ class VideoQualityAnalyzer { Clock* clock(); private: - int64_t DecodedFrameCaptureTimeOffsetMs(const VideoFrame& decoded) const; - int64_t CapturedFrameCaptureTimeOffsetMs(const VideoFrame& captured) const; void PrintHeaders(); void PrintFrameInfo(const VideoFrameQualityInfo& sample); const std::unique_ptr writer_; std::vector> frame_info_handlers_; std::deque captured_frames_; - absl::optional first_capture_ntp_time_ms_; - absl::optional first_decode_rtp_timestamp_; rtc::TaskQueue task_queue_; };