base_capturer_pipewire: Time the capturer
This CL records the time it took to capture a frame. Bug: chromium:1291247 Change-Id: I31cbb2ca6ae5b9449b8fd154182105a3ce2c851e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/288660 Commit-Queue: Salman Malik <salmanmalik@chromium.org> Reviewed-by: Alexander Cooper <alcooper@chromium.org> Auto-Submit: Salman Malik <salmanmalik@chromium.org> Cr-Commit-Position: refs/heads/main@{#38933}
This commit is contained in:
parent
4f26c25b62
commit
4dc7a3e2be
@ -17,6 +17,8 @@
|
||||
#include "modules/portal/xdg_desktop_portal_utils.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/time_utils.h"
|
||||
#include "rtc_base/trace_event.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -136,6 +138,7 @@ void BaseCapturerPipeWire::Start(Callback* callback) {
|
||||
}
|
||||
|
||||
void BaseCapturerPipeWire::CaptureFrame() {
|
||||
TRACE_EVENT0("webrtc", "BaseCapturerPipeWire::CaptureFrame");
|
||||
if (capturer_failed_) {
|
||||
// This could be recoverable if the source list is re-summoned; but for our
|
||||
// purposes this is fine, since it requires intervention to resolve and
|
||||
@ -144,6 +147,7 @@ void BaseCapturerPipeWire::CaptureFrame() {
|
||||
return;
|
||||
}
|
||||
|
||||
int64_t capture_start_time_nanos = rtc::TimeNanos();
|
||||
std::unique_ptr<DesktopFrame> frame =
|
||||
options_.screencast_stream()->CaptureFrame();
|
||||
|
||||
@ -156,6 +160,8 @@ void BaseCapturerPipeWire::CaptureFrame() {
|
||||
// the frame, see ScreenCapturerX11::CaptureFrame.
|
||||
|
||||
frame->set_capturer_id(DesktopCapturerId::kWaylandCapturerLinux);
|
||||
frame->set_capture_time_ms((rtc::TimeNanos() - capture_start_time_nanos) /
|
||||
rtc::kNumNanosecsPerMillisec);
|
||||
callback_->OnCaptureResult(Result::SUCCESS, std::move(frame));
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user