shared_screencast_stream: Set WL capturer id

For frames captured and sent to the callback immediately, we
are not sending the capturer ID as we used to do in base capturer
pipewire. Adding the capturer id as well as the frame capture time
so as to keep the sent frame to be in sync with the
non-immediate-frame-send implementation.

Bug: chromium:1291247
Change-Id: I02693907928b9e770ea56f89b46c37f17f4bc4a3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291680
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Auto-Submit: Salman Malik <salmanmalik@chromium.org>
Cr-Commit-Position: refs/heads/main@{#39228}
This commit is contained in:
Salman 2023-01-30 15:53:06 +00:00 committed by WebRTC LUCI CQ
parent 9214718cc5
commit 48220310ae

View File

@ -26,6 +26,7 @@
#include "rtc_base/logging.h"
#include "rtc_base/sanitizer.h"
#include "rtc_base/synchronization/mutex.h"
#include "rtc_base/time_utils.h"
namespace webrtc {
@ -690,6 +691,7 @@ void SharedScreenCastStreamPrivate::NotifyCallbackOfNewFrame(
RTC_NO_SANITIZE("cfi-icall")
void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
int64_t capture_start_time_nanos = rtc::TimeNanos();
if (callback_) {
callback_->OnFrameCaptureStart();
}
@ -941,7 +943,11 @@ void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
queue_.current_frame()->set_may_contain_cursor(is_cursor_embedded_);
if (callback_) {
NotifyCallbackOfNewFrame(queue_.current_frame()->Share());
std::unique_ptr<SharedDesktopFrame> frame = queue_.current_frame()->Share();
frame->set_capturer_id(DesktopCapturerId::kWaylandCapturerLinux);
frame->set_capture_time_ms((rtc::TimeNanos() - capture_start_time_nanos) /
rtc::kNumNanosecsPerMillisec);
NotifyCallbackOfNewFrame(std::move(frame));
}
}