Add more logs in DX capturer
This is a trivial change to add more logs in DX capturer components for debugging purpose. Bug: chromium:764258 Change-Id: I406127d838a522f0226720434e840c7163b4719d Reviewed-on: https://webrtc-review.googlesource.com/3541 Commit-Queue: Zijie He <zijiehe@chromium.org> Reviewed-by: Jamie Walch <jamiewalch@chromium.org> Cr-Commit-Position: refs/heads/master@{#19960}
This commit is contained in:
parent
54df4b1498
commit
8f1b93c104
@ -89,6 +89,12 @@ bool DxgiAdapterDuplicator::DoInitialize() {
|
||||
|
||||
duplicators_.push_back(std::move(duplicator));
|
||||
desktop_rect_.UnionWith(duplicators_.back().desktop_rect());
|
||||
} else {
|
||||
LOG(LS_ERROR) << (desc.AttachedToDesktop ? "Attached" : "Detached")
|
||||
<< " output " << i << " (" << desc.DesktopCoordinates.top
|
||||
<< ", " << desc.DesktopCoordinates.left << ") - ("
|
||||
<< desc.DesktopCoordinates.bottom << ", "
|
||||
<< desc.DesktopCoordinates.right << ") is ignored.";
|
||||
}
|
||||
} else {
|
||||
LOG(LS_WARNING) << "Failed to get output description of device " << i
|
||||
|
||||
@ -25,6 +25,27 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
// static
|
||||
std::string DxgiDuplicatorController::ResultName(
|
||||
DxgiDuplicatorController::Result result) {
|
||||
switch (result) {
|
||||
case Result::SUCCEEDED:
|
||||
return "Succeeded";
|
||||
case Result::UNSUPPORTED_SESSION:
|
||||
return "Unsupported session";
|
||||
case Result::FRAME_PREPARE_FAILED:
|
||||
return "Frame preparation failed";
|
||||
case Result::INITIALIZATION_FAILED:
|
||||
return "Initialization failed";
|
||||
case Result::DUPLICATION_FAILED:
|
||||
return "Duplication failed";
|
||||
case Result::INVALID_MONITOR_ID:
|
||||
return "Invalid monitor id";
|
||||
default:
|
||||
return "Unknown error";
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
rtc::scoped_refptr<DxgiDuplicatorController>
|
||||
DxgiDuplicatorController::Instance() {
|
||||
@ -305,7 +326,7 @@ bool DxgiDuplicatorController::DoDuplicateUnlocked(Context* context,
|
||||
}
|
||||
|
||||
if (result) {
|
||||
target->set_dpi(dpi());
|
||||
target->set_dpi(dpi_);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -439,6 +460,8 @@ bool DxgiDuplicatorController::EnsureFrameCaptured(Context* context,
|
||||
return false;
|
||||
}
|
||||
if (rtc::TimeMillis() - start_ms > timeout_ms) {
|
||||
LOG(LS_ERROR) << "Failed to capture " << frames_to_skip << " frames "
|
||||
"within " << timeout_ms << " milliseconds.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,6 +68,10 @@ class DxgiDuplicatorController {
|
||||
INVALID_MONITOR_ID,
|
||||
};
|
||||
|
||||
// Converts |result| into user-friendly string representation. The return
|
||||
// value should not be used to identify error types.
|
||||
static std::string ResultName(Result result);
|
||||
|
||||
// Returns the singleton instance of DxgiDuplicatorController.
|
||||
static rtc::scoped_refptr<DxgiDuplicatorController> Instance();
|
||||
|
||||
|
||||
@ -135,6 +135,11 @@ void ScreenCapturerWinDirectx::CaptureFrame() {
|
||||
}
|
||||
|
||||
using DuplicateResult = DxgiDuplicatorController::Result;
|
||||
if (result != DuplicateResult::SUCCEEDED) {
|
||||
LOG(LS_ERROR) << "DxgiDuplicatorController failed to capture desktop, "
|
||||
"error code "
|
||||
<< DxgiDuplicatorController::ResultName(result);
|
||||
}
|
||||
switch (result) {
|
||||
case DuplicateResult::UNSUPPORTED_SESSION: {
|
||||
LOG(LS_ERROR) << "Current binary is running on a session not supported "
|
||||
@ -150,6 +155,7 @@ void ScreenCapturerWinDirectx::CaptureFrame() {
|
||||
break;
|
||||
}
|
||||
case DuplicateResult::INVALID_MONITOR_ID: {
|
||||
LOG(LS_ERROR) << "Invalid monitor id " << current_screen_id_;
|
||||
callback_->OnCaptureResult(Result::ERROR_PERMANENT, nullptr);
|
||||
break;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user