Bug 1729455 - Remove unused arg in DesktopCaptureImpl::DeliverCapturedFrame and simplify. r=bwc,ng

Differential Revision: https://phabricator.services.mozilla.com/D128246
This commit is contained in:
Andreas Pehrson 2021-11-02 14:35:56 +00:00
Родитель 26280a79dc
Коммит 6cc9a2ba1a
2 изменённых файлов: 10 добавлений и 26 удалений

Просмотреть файл

@ -382,11 +382,7 @@ DesktopCaptureImpl::DesktopCaptureImpl(const int32_t id, const char* uniqueId,
_deviceType(type),
_requestedCapability(),
_rotateFrame(kVideoRotation_0),
last_capture_time_(rtc::TimeNanos() / rtc::kNumNanosecsPerMillisec),
// XXX Note that this won't capture drift!
delta_ntp_internal_ms_(
Clock::GetRealTimeClock()->CurrentNtpInMilliseconds() -
last_capture_time_),
last_capture_time_ms_(rtc::TimeMillis()),
time_event_(EventWrapper::Create()),
#if defined(_WIN32)
capturer_thread_(
@ -440,22 +436,17 @@ int32_t DesktopCaptureImpl::StopCaptureIfAllClientsClose() {
}
int32_t DesktopCaptureImpl::DeliverCapturedFrame(
webrtc::VideoFrame& captureFrame, int64_t capture_time) {
webrtc::VideoFrame& captureFrame) {
UpdateFrameCount(); // frame count used for local frame rate callBack.
// Set the capture time
if (capture_time != 0) {
captureFrame.set_timestamp_us(1000 *
(capture_time - delta_ntp_internal_ms_));
} else {
captureFrame.set_timestamp_us(rtc::TimeMicros());
}
captureFrame.set_timestamp_us(rtc::TimeMicros());
if (captureFrame.render_time_ms() == last_capture_time_) {
if (captureFrame.render_time_ms() == last_capture_time_ms_) {
// We don't allow the same capture time for two frames, drop this one.
return -1;
}
last_capture_time_ = captureFrame.render_time_ms();
last_capture_time_ms_ = captureFrame.render_time_ms();
for (auto dataCallBack : _dataCallBacks) {
dataCallBack->OnFrame(captureFrame);
@ -467,7 +458,7 @@ int32_t DesktopCaptureImpl::DeliverCapturedFrame(
// Copied from VideoCaptureImpl::IncomingFrame. See Bug 1038324
int32_t DesktopCaptureImpl::IncomingFrame(
uint8_t* videoFrame, size_t videoFrameLength,
const VideoCaptureCapability& frameInfo, int64_t captureTime) {
const VideoCaptureCapability& frameInfo) {
int64_t startProcessTime = rtc::TimeNanos();
rtc::CritScope cs(&_apiCs);
@ -507,9 +498,8 @@ int32_t DesktopCaptureImpl::IncomingFrame(
}
VideoFrame captureFrame(buffer, 0, rtc::TimeMillis(), kVideoRotation_0);
captureFrame.set_ntp_time_ms(captureTime);
DeliverCapturedFrame(captureFrame, captureTime);
DeliverCapturedFrame(captureFrame);
const int64_t processTime =
(rtc::TimeNanos() - startProcessTime) / rtc::kNumNanosecsPerMillisec;

Просмотреть файл

@ -178,10 +178,8 @@ class DesktopCaptureImpl : public DesktopCapturer::Callback,
const char* CurrentDeviceName() const override;
// |capture_time| must be specified in the NTP time format in milliseconds.
int32_t IncomingFrame(uint8_t* videoFrame, size_t videoFrameLength,
const VideoCaptureCapability& frameInfo,
int64_t captureTime = 0);
const VideoCaptureCapability& frameInfo);
// Platform dependent
int32_t StartCapture(const VideoCaptureCapability& capability) override;
@ -194,8 +192,7 @@ class DesktopCaptureImpl : public DesktopCapturer::Callback,
DesktopCaptureImpl(const int32_t id, const char* uniqueId,
const CaptureDeviceType type);
virtual ~DesktopCaptureImpl();
int32_t DeliverCapturedFrame(webrtc::VideoFrame& captureFrame,
int64_t capture_time);
int32_t DeliverCapturedFrame(webrtc::VideoFrame& captureFrame);
static const uint32_t kMaxDesktopCaptureCpuUsage =
50; // maximum CPU usage in %
@ -223,10 +220,7 @@ class DesktopCaptureImpl : public DesktopCapturer::Callback,
std::atomic<uint32_t> _maxFPSNeeded;
// Used to make sure incoming timestamp is increasing for every frame.
int64_t last_capture_time_;
// Delta used for translating between NTP and internal timestamps.
const int64_t delta_ntp_internal_ms_;
int64_t last_capture_time_ms_;
// DesktopCapturer::Callback interface.
void OnCaptureResult(DesktopCapturer::Result result,