Removes broken frame matching code in scenario quality stats.
The timestamps doesn't always match properly, currently causing flakiness and crashes. Pending a better solution we'll assume that no frames are lost. Bug: webrtc:9510 Change-Id: I1b0a5025ac9a45c71b611bcddbbad7a8cf385e01 Reviewed-on: https://webrtc-review.googlesource.com/c/123483 Commit-Queue: Sebastian Jansson <srte@webrtc.org> Reviewed-by: Sergey Silkin <ssilkin@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26772}
This commit is contained in:

committed by
Commit Bot

parent
b35baccd6f
commit
4d2367a69e
@ -40,8 +40,6 @@ VideoQualityAnalyzer::~VideoQualityAnalyzer() {
|
|||||||
void VideoQualityAnalyzer::OnCapturedFrame(const VideoFrame& frame) {
|
void VideoQualityAnalyzer::OnCapturedFrame(const VideoFrame& frame) {
|
||||||
VideoFrame copy = frame;
|
VideoFrame copy = frame;
|
||||||
task_queue_.PostTask([this, copy]() mutable {
|
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));
|
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.ntp_time_ms());
|
||||||
RTC_CHECK(frame.timestamp());
|
RTC_CHECK(frame.timestamp());
|
||||||
task_queue_.PostTask([this, decoded] {
|
task_queue_.PostTask([this, decoded] {
|
||||||
// If first frame never is received, this value will be wrong. However, that
|
// TODO(srte): Add detection and handling of lost frames.
|
||||||
// is something that is very unlikely to happen.
|
|
||||||
if (!first_decode_rtp_timestamp_)
|
|
||||||
first_decode_rtp_timestamp_ = decoded.timestamp();
|
|
||||||
RTC_CHECK(!captured_frames_.empty());
|
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());
|
VideoFrame captured = std::move(captured_frames_.front());
|
||||||
captured_frames_.pop_front();
|
captured_frames_.pop_front();
|
||||||
|
|
||||||
VideoFrameQualityInfo decoded_info =
|
VideoFrameQualityInfo decoded_info =
|
||||||
VideoFrameQualityInfo{Timestamp::us(captured.timestamp_us()),
|
VideoFrameQualityInfo{Timestamp::us(captured.timestamp_us()),
|
||||||
Timestamp::ms(decoded.timestamp() / 90.0),
|
Timestamp::ms(decoded.timestamp() / 90.0),
|
||||||
@ -94,21 +69,6 @@ bool VideoQualityAnalyzer::Active() const {
|
|||||||
return !frame_info_handlers_.empty();
|
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() {
|
void VideoQualityAnalyzer::PrintHeaders() {
|
||||||
writer_->Write("capt recv_capt render width height psnr\n");
|
writer_->Write("capt recv_capt render width height psnr\n");
|
||||||
}
|
}
|
||||||
|
@ -44,16 +44,12 @@ class VideoQualityAnalyzer {
|
|||||||
Clock* clock();
|
Clock* clock();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int64_t DecodedFrameCaptureTimeOffsetMs(const VideoFrame& decoded) const;
|
|
||||||
int64_t CapturedFrameCaptureTimeOffsetMs(const VideoFrame& captured) const;
|
|
||||||
void PrintHeaders();
|
void PrintHeaders();
|
||||||
void PrintFrameInfo(const VideoFrameQualityInfo& sample);
|
void PrintFrameInfo(const VideoFrameQualityInfo& sample);
|
||||||
const std::unique_ptr<RtcEventLogOutput> writer_;
|
const std::unique_ptr<RtcEventLogOutput> writer_;
|
||||||
std::vector<std::function<void(const VideoFrameQualityInfo&)>>
|
std::vector<std::function<void(const VideoFrameQualityInfo&)>>
|
||||||
frame_info_handlers_;
|
frame_info_handlers_;
|
||||||
std::deque<VideoFrame> captured_frames_;
|
std::deque<VideoFrame> captured_frames_;
|
||||||
absl::optional<int64_t> first_capture_ntp_time_ms_;
|
|
||||||
absl::optional<uint32_t> first_decode_rtp_timestamp_;
|
|
||||||
rtc::TaskQueue task_queue_;
|
rtc::TaskQueue task_queue_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user