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

[CoreVideo] Add support for Xcode 13 beta3. #12257

Merged
merged 36 commits into from
Sep 13, 2021

Conversation

mandel-macaque
Copy link
Member

No description provided.

@mandel-macaque mandel-macaque added the note-highlight Worth calling out specifically in release notes label Jul 27, 2021
public bool TryTranslateTime (CVTimeStamp inTime, out CVTimeStamp? outTime)
{
outTime = null;
if (CVDisplayLinkTranslateTime (this.Handle, inTime, out var translated) == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The documentation says this:

outTime
A pointer to a CVTimeStamp structure into which the target time is written. Before calling, you must set the version field (currently 0) to indicate which version of the structure you want. You should also set the flags field to specify which representations to translate to.

You're passing in null, which is not what the API calls for. It looks from the documentation that this should be a ref parameter and not an out parameter, and outTime.Version should be 0.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch, I'll update it, thx!

return Runtime.GetINativeObject<T> (CVBufferGetAttachment (handle, key.Handle, out attachmentMode), false);
}
#else
public NSObject GetAttachment (NSString key, out CVAttachmentMode attachmentMode)
{
if (key == null)
throw new ArgumentNullException ("key");
return Runtime.GetNSObject (CVBufferGetAttachment (handle, key.Handle, out attachmentMode));
if (PlatformHelper.CheckSystemVersion (12, 0))
return Runtime.GetNSObject (CVBufferCopyAttachment (handle, key.Handle, out attachmentMode));
Copy link
Contributor

Choose a reason for hiding this comment

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

missing argument for ownership

Copy link
Member Author

@mandel-macaque mandel-macaque Jul 27, 2021

Choose a reason for hiding this comment

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

The API without the <T> does not have the argument: https://docs.microsoft.com/en-us/dotnet/api/objcruntime.runtime.getnsobject?view=xamarin-ios-sdk-12#ObjCRuntime_Runtime_GetNSObject_System_IntPtr_ Which is the one being used, should I switch to the version?

Copy link
Contributor

Choose a reason for hiding this comment

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

yup, the generic version is newer/better
the alternative would be to explicitly call memory managed methods... which is less desirable

Copy link
Member

Choose a reason for hiding this comment

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

This still needs to be fixed

#elif MONOMAC
if (PlatformHelper.CheckSystemVersion (12, 0))
#endif
return (NSDictionary) Runtime.GetNSObject (CVBufferCopyAttachments (handle, attachmentMode));
Copy link
Contributor

Choose a reason for hiding this comment

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

same, you're not specifying the ownership (using the default)

Copy link
Member Author

Choose a reason for hiding this comment

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

same :)

Copy link
Member

Choose a reason for hiding this comment

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

same :)

src/CoreVideo/CVDisplayLink.cs Outdated Show resolved Hide resolved
IntPtr handle = IntPtr.Zero;
unsafe {
fixed (uint *displaysHandle = displayIds) {
result = CVDisplayLinkCreateWithCGDisplays (displaysHandle, displayIds.Length, out handle);
Copy link
Contributor

Choose a reason for hiding this comment

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

NullReferenceException if displayIds is null - which is not validated

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder why #nullable enable did not report an error...

src/CoreVideo/CVDisplayLink.cs Outdated Show resolved Hide resolved
src/CoreVideo/CVDisplayLink.cs Outdated Show resolved Hide resolved
static extern int CVDisplayLinkTranslateTime (IntPtr displayLink, CVTimeStamp inTime, ref CVTimeStamp outTime);

[Mac (12,0), NoiOS, NoTV]
public bool TryTranslateTime (CVTimeStamp inTime, out CVTimeStamp? outTime)
Copy link
Contributor

Choose a reason for hiding this comment

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

@vs-mobiletools-engineering-service2
Copy link
Collaborator

❌ [PR Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

API & Generator diff

ℹ️ API Diff (from PR only) (please review changes)
ℹ️ Generator Diff (please review changes)

GitHub pages

Results can be found in the following github pages (it might take some time to publish):

Test results

3 tests failed, 86 tests passed.

Failed tests

  • introspection/Mac Modern/Debug: Failed (Test run failed.
    Tests run: 37 Passed: 35 Inconclusive: 0 Failed: 1 Ignored: 1)
  • introspection/Mac Catalyst/Debug: Failed (Tests run: 44 Passed: 38 Inconclusive: 0 Failed: 1 Ignored: 5)
  • monotouch-test/Mac Catalyst/Debug [dotnet]: Failed (Tests run: 2629 Passed: 2488 Inconclusive: 35 Failed: 1 Ignored: 140)

Pipeline on Agent XAMBOT-1096.BigSur'
Merge c33bb04 into f611cd8

Copy link
Member

@rolfbjarne rolfbjarne left a comment

Choose a reason for hiding this comment

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

Also manual bindings need manual tests 😄

@@ -21,7 +21,7 @@

namespace CoreVideo {

[iOS (8,0)]
[iOS (8,0), Mac (12,0)]
Copy link
Member

Choose a reason for hiding this comment

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

Mac Catalyst?

@@ -22,7 +22,7 @@

namespace CoreVideo {

[iOS (8,0)]
[iOS (8,0), Mac (12,0)]
Copy link
Member

Choose a reason for hiding this comment

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

Mac Catalyst?

[DllImport (Constants.CoreVideoLibrary)]
extern static /* CFTypeRef */ IntPtr CVBufferGetAttachment (/* CVBufferRef */ IntPtr buffer, /* CFStringRef */ IntPtr key, out CVAttachmentMode attachmentMode);

// The new method is the same as the old one but changing the ownership from Get to Copy, so we will use the new version if possible since the
// older method has been deprecatd.
[Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0)]
Copy link
Member

Choose a reason for hiding this comment

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

Mac Catalyst?

[DllImport (Constants.CoreVideoLibrary)]
extern static /* CFDictionaryRef */ IntPtr CVBufferGetAttachments (/* CVBufferRef */ IntPtr buffer, CVAttachmentMode attachmentMode);

[Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0)]
Copy link
Member

Choose a reason for hiding this comment

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

Mac Catalyst?

src/CoreVideo/CVBuffer.cs Show resolved Hide resolved
src/CoreVideo/CVDisplayLink.cs Outdated Show resolved Hide resolved
src/CoreVideo/CVDisplayLink.cs Outdated Show resolved Hide resolved
src/CoreVideo/CVDisplayLink.cs Outdated Show resolved Hide resolved
src/CoreVideo/CVDisplayLink.cs Outdated Show resolved Hide resolved
src/CoreVideo/CVDisplayLink.cs Outdated Show resolved Hide resolved
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
@vs-mobiletools-engineering-service2
Copy link
Collaborator

🔥 Tests failed catastrophically on Build (no summary found). 🔥

Result file $(TEST_SUMMARY_PATH) not found.

Pipeline on Agent
Merge 21b7238 into 3336910

@vs-mobiletools-engineering-service2
Copy link
Collaborator

❌ [PR Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

API & Generator diff

ℹ️ API Diff (from PR only) (please review changes)
ℹ️ Generator Diff (please review changes)

GitHub pages

Results can be found in the following github pages (it might take some time to publish):

Test results

15 tests failed, 74 tests passed.

Failed tests

  • introspection/Mac Modern/Debug: Failed (Test run failed.
    Tests run: 37 Passed: 35 Inconclusive: 0 Failed: 1 Ignored: 1)
  • introspection/Mac Catalyst/Debug: Failed (Tests run: 44 Passed: 38 Inconclusive: 0 Failed: 1 Ignored: 5)
  • monotouch-test/Mac Catalyst/Debug [dotnet]: Failed (Tests run: 2629 Passed: 2489 Inconclusive: 35 Failed: 2 Ignored: 138)
  • monotouch-test/iOS Unified 64-bits - simulator/Debug: Failed
  • monotouch-test/iOS Unified 64-bits - simulator/Debug (LinkSdk): Failed
  • monotouch-test/iOS Unified 64-bits - simulator/Debug (static registrar): Failed
  • monotouch-test/iOS Unified 64-bits - simulator/Release (all optimizations): Failed
  • monotouch-test/tvOS - simulator/Debug: Failed
  • monotouch-test/tvOS - simulator/Debug (LinkSdk): Failed
  • monotouch-test/tvOS - simulator/Debug (static registrar): Failed
  • monotouch-test/tvOS - simulator/Release (all optimizations): Failed
  • monotouch-test/watchOS 32-bits - simulator/Debug: Failed
  • monotouch-test/watchOS 32-bits - simulator/Debug (LinkSdk): Failed
  • monotouch-test/watchOS 32-bits - simulator/Debug (static registrar): Failed
  • monotouch-test/watchOS 32-bits - simulator/Release (all optimizations): Failed

Pipeline on Agent XAMBOT-1104.BigSur'
Merge ba74e6f into 3336910

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🔥 Tests failed catastrophically on Build (no summary found). 🔥

Result file $(TEST_SUMMARY_PATH) not found.

Pipeline on Agent
Merge 43a87fc into 243cc40

}

[Test]
public void DefaultconstructorTest () => Assert.DoesNotThrow (() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: DefaultconstructorTest -> DefaultConstructorTest

return (NSDictionary) Runtime.GetNSObject (CVBufferCopyAttachments (handle, attachmentMode));
return (NSDictionary) Runtime.GetNSObject (CVBufferGetAttachments (handle, attachmentMode));
return Runtime.GetINativeObject<NSDictionary> (CVBufferCopyAttachments (handle, attachmentMode), true);
return Runtime.GetINativeObject<NSDictionary> (CVBufferGetAttachments (handle, attachmentMode), false);
Copy link
Contributor

Choose a reason for hiding this comment

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

Runtime.GetNSObject<NSDictionary> would be better since you know the return type (and GetINativeObject is more complex)

@@ -150,9 +151,9 @@ public NSObject GetAttachment (NSString key, out CVAttachmentMode attachmentMode
if (key == null)
throw new ArgumentNullException ("key");
if (PlatformHelper.CheckSystemVersion (12, 0))
return Runtime.GetNSObject (CVBufferCopyAttachment (handle, key.Handle, out attachmentMode));
return Runtime.GetINativeObject<NSObject> (CVBufferCopyAttachment (handle, key.Handle, out attachmentMode), true);
Copy link
Contributor

Choose a reason for hiding this comment

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

Runtime.GetNSObject<NSObject> (ptr, true)

since GetINativeObject logic is more complex and you already know the return type.

else
return Runtime.GetNSObject (CVBufferGetAttachment (handle, key.Handle, out attachmentMode));
return Runtime.GetINativeObject<NSObject> (CVBufferGetAttachment (handle, key.Handle, out attachmentMode), false);
Copy link
Contributor

Choose a reason for hiding this comment

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

same

{
// we need to have access to the media display to be able to perform
// the displaylink tests
mainDisplayId = CGDisplay.MainDisplayID;
Copy link
Contributor

Choose a reason for hiding this comment

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

mainDisplayId does not seem to be used (except in TearDown)
are you missing an Ignore in case no valid is was returned ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I can remove SetUp and TearDown.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

❌ [PR Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

API & Generator diff

ℹ️ API Diff (from PR only) (please review changes)
ℹ️ Generator Diff (please review changes)

GitHub pages

Results can be found in the following github pages (it might take some time to publish):

Test results

1 tests failed, 107 tests passed.

Failed tests

  • introspection/Mac Catalyst/Debug: Failed (Tests run: 44 Passed: 39 Inconclusive: 0 Failed: 1 Ignored: 4)

Pipeline on Agent XAMBOT-1096.BigSur'
Merge 94d8143 into 5b896c7

@vs-mobiletools-engineering-service2
Copy link
Collaborator

❌ [PR Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

API & Generator diff

ℹ️ API Diff (from PR only) (please review changes)
ℹ️ Generator Diff (please review changes)

GitHub pages

Results can be found in the following github pages (it might take some time to publish):

Test results

2 tests failed, 106 tests passed.

Failed tests

  • monotouch-test/Mac Catalyst/Debug [dotnet]: Failed (Tests run: 2644 Passed: 2490 Inconclusive: 35 Failed: 1 Ignored: 153)
  • introspection/Mac Catalyst/Debug: Failed (Tests run: 44 Passed: 39 Inconclusive: 0 Failed: 1 Ignored: 4)

Pipeline on Agent XAMBOT-1094.BigSur'
Merge 050f6f0 into f9c0589

@vs-mobiletools-engineering-service2
Copy link
Collaborator

❌ [PR Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

API & Generator diff

ℹ️ API Diff (from PR only) (please review changes)
ℹ️ Generator Diff (please review changes)

GitHub pages

Results can be found in the following github pages (it might take some time to publish):

Test results

2 tests failed, 100 tests passed.

Failed tests

  • link sdk/tvOS - simulator/Debug: Failed
  • link sdk/tvOS - simulator/Release: Failed

Pipeline on Agent XAMBOT-1103.BigSur'
Merge e522eb4 into c2fda6e

public bool HasAttachment (NSString key)
{
if (key == null)
throw new ArgumentNullException (nameof (key));
Copy link
Contributor

Choose a reason for hiding this comment

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

minor: nicer (smaller code and no potential == overload to mess things up)

if (key is null)
	ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (key));

@vs-mobiletools-engineering-service2
Copy link
Collaborator

❌ [PR Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

API & Generator diff

ℹ️ API Diff (from PR only) (please review changes)
ℹ️ Generator Diff (please review changes)

GitHub pages

Results can be found in the following github pages (it might take some time to publish):

Test results

5 tests failed, 97 tests passed.

Failed tests

  • fsharp/Mac Catalyst [dotnet]/Debug [dotnet]: TimedOut (Execution timed out after 1200 seconds.
    No test log file was produced)
  • interdependent-binding-projects/Mac Catalyst [dotnet]/Debug [dotnet]: TimedOut (Execution timed out after 1200 seconds.
    No test log file was produced)
  • Xtro/Mac: Failed (Test run failed.)
  • link sdk/tvOS - simulator/Debug: Failed
  • link sdk/tvOS - simulator/Release: Failed

Pipeline on Agent XAMBOT-1098.BigSur'
Merge d44a025 into 55e8c60

@vs-mobiletools-engineering-service2
Copy link
Collaborator

❌ [PR Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

API & Generator diff

ℹ️ API Diff (from PR only) (please review changes)
ℹ️ Generator Diff (please review changes)

GitHub pages

Results can be found in the following github pages (it might take some time to publish):

Test results

3 tests failed, 99 tests passed.

Failed tests

  • dont link/Mac Catalyst [dotnet]/Debug [dotnet]: TimedOut (Execution timed out after 1200 seconds.
    No test log file was produced)
  • link sdk/tvOS - simulator/Debug: Failed
  • link sdk/tvOS - simulator/Release: Failed

Pipeline on Agent XAMBOT-1104.BigSur'
Merge 3949601 into 42dd6ce

@mandel-macaque
Copy link
Member Author

Known issues: #12640

@mandel-macaque mandel-macaque merged commit f1611df into xamarin:main Sep 13, 2021
@mandel-macaque mandel-macaque deleted the corevideo-xcode13-beta3 branch September 13, 2021 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
note-highlight Worth calling out specifically in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants