Improve example video analyzer for use in debugging
Bug: webrtc:10138 Change-Id: I40e81179ae6bec83efc57a5723450690c21c3481 Reviewed-on: https://webrtc-review.googlesource.com/c/124782 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26883}
This commit is contained in:
@ -44,13 +44,16 @@ uint16_t ExampleVideoQualityAnalyzer::OnFrameCaptured(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ExampleVideoQualityAnalyzer::OnFramePreEncode(
|
void ExampleVideoQualityAnalyzer::OnFramePreEncode(
|
||||||
const webrtc::VideoFrame& frame) {}
|
const webrtc::VideoFrame& frame) {
|
||||||
|
rtc::CritScope crit(&lock_);
|
||||||
|
++frames_pre_encoded_;
|
||||||
|
}
|
||||||
|
|
||||||
void ExampleVideoQualityAnalyzer::OnFrameEncoded(
|
void ExampleVideoQualityAnalyzer::OnFrameEncoded(
|
||||||
uint16_t frame_id,
|
uint16_t frame_id,
|
||||||
const webrtc::EncodedImage& encoded_image) {
|
const webrtc::EncodedImage& encoded_image) {
|
||||||
rtc::CritScope crit(&lock_);
|
rtc::CritScope crit(&lock_);
|
||||||
++frames_sent_;
|
++frames_encoded_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExampleVideoQualityAnalyzer::OnFrameDropped(
|
void ExampleVideoQualityAnalyzer::OnFrameDropped(
|
||||||
@ -70,7 +73,10 @@ void ExampleVideoQualityAnalyzer::OnFrameReceived(
|
|||||||
void ExampleVideoQualityAnalyzer::OnFrameDecoded(
|
void ExampleVideoQualityAnalyzer::OnFrameDecoded(
|
||||||
const webrtc::VideoFrame& frame,
|
const webrtc::VideoFrame& frame,
|
||||||
absl::optional<int32_t> decode_time_ms,
|
absl::optional<int32_t> decode_time_ms,
|
||||||
absl::optional<uint8_t> qp) {}
|
absl::optional<uint8_t> qp) {
|
||||||
|
rtc::CritScope crit(&lock_);
|
||||||
|
++frames_decoded_;
|
||||||
|
}
|
||||||
|
|
||||||
void ExampleVideoQualityAnalyzer::OnFrameRendered(
|
void ExampleVideoQualityAnalyzer::OnFrameRendered(
|
||||||
const webrtc::VideoFrame& frame) {
|
const webrtc::VideoFrame& frame) {
|
||||||
@ -112,9 +118,14 @@ uint64_t ExampleVideoQualityAnalyzer::frames_captured() const {
|
|||||||
return frames_captured_;
|
return frames_captured_;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t ExampleVideoQualityAnalyzer::frames_sent() const {
|
uint64_t ExampleVideoQualityAnalyzer::frames_pre_encoded() const {
|
||||||
rtc::CritScope crit(&lock_);
|
rtc::CritScope crit(&lock_);
|
||||||
return frames_sent_;
|
return frames_pre_encoded_;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t ExampleVideoQualityAnalyzer::frames_encoded() const {
|
||||||
|
rtc::CritScope crit(&lock_);
|
||||||
|
return frames_encoded_;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t ExampleVideoQualityAnalyzer::frames_received() const {
|
uint64_t ExampleVideoQualityAnalyzer::frames_received() const {
|
||||||
@ -122,9 +133,9 @@ uint64_t ExampleVideoQualityAnalyzer::frames_received() const {
|
|||||||
return frames_received_;
|
return frames_received_;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t ExampleVideoQualityAnalyzer::frames_dropped() const {
|
uint64_t ExampleVideoQualityAnalyzer::frames_decoded() const {
|
||||||
rtc::CritScope crit(&lock_);
|
rtc::CritScope crit(&lock_);
|
||||||
return frames_dropped_;
|
return frames_decoded_;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t ExampleVideoQualityAnalyzer::frames_rendered() const {
|
uint64_t ExampleVideoQualityAnalyzer::frames_rendered() const {
|
||||||
@ -132,5 +143,10 @@ uint64_t ExampleVideoQualityAnalyzer::frames_rendered() const {
|
|||||||
return frames_rendered_;
|
return frames_rendered_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t ExampleVideoQualityAnalyzer::frames_dropped() const {
|
||||||
|
rtc::CritScope crit(&lock_);
|
||||||
|
return frames_dropped_;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace test
|
} // namespace test
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
@ -52,10 +52,12 @@ class ExampleVideoQualityAnalyzer : public VideoQualityAnalyzerInterface {
|
|||||||
std::string GetStreamLabel(uint16_t frame_id) override;
|
std::string GetStreamLabel(uint16_t frame_id) override;
|
||||||
|
|
||||||
uint64_t frames_captured() const;
|
uint64_t frames_captured() const;
|
||||||
uint64_t frames_sent() const;
|
uint64_t frames_pre_encoded() const;
|
||||||
|
uint64_t frames_encoded() const;
|
||||||
uint64_t frames_received() const;
|
uint64_t frames_received() const;
|
||||||
uint64_t frames_dropped() const;
|
uint64_t frames_decoded() const;
|
||||||
uint64_t frames_rendered() const;
|
uint64_t frames_rendered() const;
|
||||||
|
uint64_t frames_dropped() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// When peer A captured the frame it will come into analyzer's OnFrameCaptured
|
// When peer A captured the frame it will come into analyzer's OnFrameCaptured
|
||||||
@ -71,10 +73,12 @@ class ExampleVideoQualityAnalyzer : public VideoQualityAnalyzerInterface {
|
|||||||
std::map<uint16_t, std::string> frames_to_stream_label_ RTC_GUARDED_BY(lock_);
|
std::map<uint16_t, std::string> frames_to_stream_label_ RTC_GUARDED_BY(lock_);
|
||||||
uint16_t next_frame_id_ RTC_GUARDED_BY(lock_) = 0;
|
uint16_t next_frame_id_ RTC_GUARDED_BY(lock_) = 0;
|
||||||
uint64_t frames_captured_ RTC_GUARDED_BY(lock_) = 0;
|
uint64_t frames_captured_ RTC_GUARDED_BY(lock_) = 0;
|
||||||
uint64_t frames_sent_ RTC_GUARDED_BY(lock_) = 0;
|
uint64_t frames_pre_encoded_ RTC_GUARDED_BY(lock_) = 0;
|
||||||
|
uint64_t frames_encoded_ RTC_GUARDED_BY(lock_) = 0;
|
||||||
uint64_t frames_received_ RTC_GUARDED_BY(lock_) = 0;
|
uint64_t frames_received_ RTC_GUARDED_BY(lock_) = 0;
|
||||||
uint64_t frames_dropped_ RTC_GUARDED_BY(lock_) = 0;
|
uint64_t frames_decoded_ RTC_GUARDED_BY(lock_) = 0;
|
||||||
uint64_t frames_rendered_ RTC_GUARDED_BY(lock_) = 0;
|
uint64_t frames_rendered_ RTC_GUARDED_BY(lock_) = 0;
|
||||||
|
uint64_t frames_dropped_ RTC_GUARDED_BY(lock_) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace test
|
} // namespace test
|
||||||
|
Reference in New Issue
Block a user