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

Handle single plane frames #101

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -513,15 +513,11 @@ HRESULT VideoCaptureWinRTInternal::FrameArrived(
hr = bitmap_buffer->GetPlaneCount(&plane_count);
}

if (SUCCEEDED(hr)) {
hr = plane_count == 2 ? S_OK : E_FAIL;
}

if (SUCCEEDED(hr)) {
if (SUCCEEDED(hr) && plane_count >= 1) {
Copy link

Choose a reason for hiding this comment

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

This change treats 1 plane and 2 plane frames identically. Is that intentional or is there any different work that needs to be done in the 1 plane case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's intentional: pfn_incoming_frame_ is able to figure out the data format and to decode it correctly.

hr = bitmap_buffer->GetPlaneDescription(0, &bitmap_plane_description_y);
}

if (SUCCEEDED(hr)) {
if (SUCCEEDED(hr) && plane_count == 2) {
Copy link

Choose a reason for hiding this comment

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

Previously, plane_count == 3 would have set hr to E_FAIL. Is there a guarantee that plane_count is never any value other than 0, 1, or 2?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right. It probably makes sense to fail if plane_count isn't 1 or 2.

hr = bitmap_buffer->GetPlaneDescription(1, &bitmap_plane_description_uv);
}

Expand Down