Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: refactor capture devices #7492

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open

Conversation

hardening
Copy link
Contributor

This big refactor abstract capture devices to prepare things for the weston backend. The refactoring make it possible to have multiple capture device at the same time (capture device is not fixed at build time)

Ticket(s) Closed

  • Closes #

Description

Implementation

Documentation & Tests Added

Testing Instructions

PR Checklist

  • Did the PR author fully test this PR end-to-end?
  • Did one PR reviewer fully test this PR end-to-end?
  • Did one PR reviewer conduct a thorough code design review?

@github-actions github-actions bot added the 📁 Repo: protocol This PR/Issue modifies /protocol code label Nov 7, 2022
@hardening hardening force-pushed the david/capture_dev_plus_test branch 2 times, most recently from 55fd123 to 21542af Compare November 7, 2022 14:06
@@ -305,27 +256,23 @@ static void update_current_device(WhistServerState* state, WhistTimer* statistic
LOG_INFO("Received an update capture device request to dimensions %dx%d with DPI %d",
true_width, true_height, state->client_dpi);

// If a device already exists, we should reconfigure or destroy it
if (device != NULL) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in retry_capture_screen(), device will be set to NULL after decided to retry.

But in this line, we remove the if (device != NULL) { here, then the code will always run into reconfigure_capture_device(), which has a FATAL_ASSERT inside:

FATAL_ASSERT(device && "NULL device was passed into reconfigure_capture_device!");

So after your change, the retry_capture_screen() will always trigger a FATAL, which makes it a useless function. Is this as expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, with the new impl device can't be NULL and that shall be an assert. Gonna correct that.

Copy link
Contributor

@wangyu- wangyu- Dec 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this functional bug hasn't been fixed yet

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've treated that at the device level

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might worth a re-review if the commit history can be recovered

@codecov
Copy link

codecov bot commented Nov 15, 2022

Codecov Report

Merging #7492 (858ab6e) into dev (c104c46) will decrease coverage by 0.70%.
The diff coverage is 45.89%.

❗ Current head 858ab6e differs from pull request most recent head 73138ff. Consider uploading reports for the commit 73138ff to get more accurate results

@@            Coverage Diff             @@
##              dev    #7492      +/-   ##
==========================================
- Coverage   56.13%   55.42%   -0.71%     
==========================================
  Files         158      166       +8     
  Lines       32519    33836    +1317     
==========================================
+ Hits        18255    18755     +500     
- Misses      14010    14827     +817     
  Partials      254      254              
Flag Coverage Δ *Carryforward flag
backend-services 49.31% <ø> (ø) Carriedforward from c104c46
protocol 56.63% <45.89%> (-0.92%) ⬇️

*This pull request uses carry forward flags. Click here to find out more.

Impacted Files Coverage Δ
protocol/server/video.c 0.00% <0.00%> (ø)
protocol/whist/video/capture/nvidiacapture.c 0.00% <0.00%> (ø)
protocol/whist/video/capture/nvx11capture.c 0.00% <0.00%> (ø)
protocol/whist/video/codec/encode.c 48.06% <0.00%> (-0.27%) ⬇️
protocol/whist/video/codec/nvidia_encode.c 0.00% <0.00%> (ø)
protocol/whist/video/cudacontext.c 43.75% <16.66%> (ø)
protocol/test/capture_test.cpp 53.14% <53.14%> (ø)
protocol/whist/video/transfercapture.c 56.41% <62.50%> (+56.41%) ⬆️
protocol/whist/video/capture/capture.c 62.82% <62.82%> (ø)
protocol/whist/video/capture/memorycapture.c 71.73% <71.73%> (ø)
... and 15 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3d16a63...73138ff. Read the comment docs.

@hardening hardening force-pushed the david/capture_dev_plus_test branch 2 times, most recently from 6af6f82 to f68fd7d Compare November 22, 2022 17:56
@github-actions
Copy link

Protocol End-to-End Streaming Test Results

Experiments Summary

Expand Summary

Experiment 1 - Bandwidth: Unbounded, Delay: None, Packet Drops: None, Queue limit: default. Download logs:

aws s3 cp s3://whist-e2e-protocol-test-logs/david/capture_dev_plus_test/2022_11_22@17-56-44/ 2022_11_22@17-56-44/ --recursive

Experiment 2 - Bandwidth: variable between 15Mbit and 30Mbit, Delay: 10 ms, Packet Drops: None, Queue Limit: None, Conditions change over time? Yes, frequency is variable between 1000 ms and 2000 ms. Download logs:

aws s3 cp s3://whist-e2e-protocol-test-logs/david/capture_dev_plus_test/2022_11_22@18-02-23/ 2022_11_22@18-02-23/ --recursive

Experiment 3 - Bandwidth: variable between 10Mbit and 20Mbit, Delay: 10 ms, Packet Drops: None, Queue Limit: None, Conditions change over time? Yes, frequency is variable between 500 ms and 2000 ms. Download logs:

aws s3 cp s3://whist-e2e-protocol-test-logs/david/capture_dev_plus_test/2022_11_22@18-06-30/ 2022_11_22@18-06-30/ --recursive

Experiment 4 - Bandwidth: 10Mbit, Delay: 10 ms, Packet Drops: None, Queue Limit: 100 packets, Conditions change over time? No.. Download logs:

aws s3 cp s3://whist-e2e-protocol-test-logs/david/capture_dev_plus_test/2022_11_22@18-10-37/ 2022_11_22@18-10-37/ --recursive

Full Results: link here

@hardening hardening force-pushed the david/capture_dev_plus_test branch 9 times, most recently from 66f196d to cceef3f Compare November 29, 2022 16:47
}
infos->last_capture_device = NVIDIA_DEVICE;
}
return ret;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the original implementation, if nvidia capture fails, the capture will smoothly switch to X11 capture (and nvidia capture will be re-created on next change of dimension). The failture will not be returned to upper level.

But in the new implementation, the failure will be returned to the upper level, causing upper level to destory both the nvidia_capture and x11 capture:
image

There is no mechainsim of smoothly failing back to X11 capture any more, which can cause more interruption for the user experience and looks like a regression.

Why do we make this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point, even if I'm not sure if the old mechanism was effectively working, I'll try to redo the mechanism that goes back to X11 (and retry NV capture).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this resolved?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes the nvx11 capture device is more robust to that, when nv capture fails we automatically fallback to X11. So if we ever return -1 it means that X11 backend is also broken.

@hardening
Copy link
Contributor Author

@wangyu- a bunch of good remarks, will treat them

@hardening hardening force-pushed the david/capture_dev_plus_test branch 2 times, most recently from d3d7e24 to a051134 Compare December 5, 2022 15:22
This big refactor abstract capture devices to prepare things for the weston backend. The refactoring
make it possible to have multiple capture device at the same time (capture device is not fixed at build time)
@wangyu-
Copy link
Contributor

wangyu- commented Dec 5, 2022

@hardening could you please not squeese all commits into one immediately after addressed the reviews? it makes reviewer very hard to know what you have changed since last review.

@hardening can you recover the commit history?

@hardening
Copy link
Contributor Author

@wangyu- Yeah sorry I'm rebasing and commit amending to have a clean log, but this has the drawback that you loose changes. So I don't think I can get back the changes since last commit (although I'm not a git expert)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📁 Repo: protocol This PR/Issue modifies /protocol code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants