-
Notifications
You must be signed in to change notification settings - Fork 511
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
[CoreVideo] Add support for Xcode 13 beta3. #12257
Conversation
src/CoreVideo/CVDisplayLink.cs
Outdated
public bool TryTranslateTime (CVTimeStamp inTime, out CVTimeStamp? outTime) | ||
{ | ||
outTime = null; | ||
if (CVDisplayLinkTranslateTime (this.Handle, inTime, out var translated) == 0) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
src/CoreVideo/CVBuffer.cs
Outdated
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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing argument for ownership
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
src/CoreVideo/CVBuffer.cs
Outdated
#elif MONOMAC | ||
if (PlatformHelper.CheckSystemVersion (12, 0)) | ||
#endif | ||
return (NSDictionary) Runtime.GetNSObject (CVBufferCopyAttachments (handle, attachmentMode)); |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same :)
There was a problem hiding this comment.
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
IntPtr handle = IntPtr.Zero; | ||
unsafe { | ||
fixed (uint *displaysHandle = displayIds) { | ||
result = CVDisplayLinkCreateWithCGDisplays (displaysHandle, displayIds.Length, out handle); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
static extern int CVDisplayLinkTranslateTime (IntPtr displayLink, CVTimeStamp inTime, ref CVTimeStamp outTime); | ||
|
||
[Mac (12,0), NoiOS, NoTV] | ||
public bool TryTranslateTime (CVTimeStamp inTime, out CVTimeStamp? outTime) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use [NotNullWhen (true)]
instead of ?
https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.codeanalysis.notnullwhenattribute?view=net-5.0
❌ [PR Build] Tests failed on Build ❌Tests failed on Build. API diff✅ API Diff from stable View API diffAPI & Generator diffℹ️ API Diff (from PR only) (please review changes) GitHub pagesResults can be found in the following github pages (it might take some time to publish): Test results3 tests failed, 86 tests passed.Failed tests
Pipeline on Agent XAMBOT-1096.BigSur' |
There was a problem hiding this 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 😄
src/CoreVideo/CVMetalTextureCache.cs
Outdated
@@ -21,7 +21,7 @@ | |||
|
|||
namespace CoreVideo { | |||
|
|||
[iOS (8,0)] | |||
[iOS (8,0), Mac (12,0)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mac Catalyst?
src/CoreVideo/CVMetalTexture.cs
Outdated
@@ -22,7 +22,7 @@ | |||
|
|||
namespace CoreVideo { | |||
|
|||
[iOS (8,0)] | |||
[iOS (8,0), Mac (12,0)] |
There was a problem hiding this comment.
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
Outdated
[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)] |
There was a problem hiding this comment.
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
Outdated
[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)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mac Catalyst?
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
🔥 Tests failed catastrophically on Build (no summary found). 🔥Result file $(TEST_SUMMARY_PATH) not found. |
This reverts commit dcbbdf3.
❌ [PR Build] Tests failed on Build ❌Tests failed on Build. API diff✅ API Diff from stable View API diffAPI & Generator diffℹ️ API Diff (from PR only) (please review changes) GitHub pagesResults can be found in the following github pages (it might take some time to publish): Test results15 tests failed, 74 tests passed.Failed tests
Pipeline on Agent XAMBOT-1104.BigSur' |
🔥 Tests failed catastrophically on Build (no summary found). 🔥Result file $(TEST_SUMMARY_PATH) not found. |
…amarin-macios into corevideo-xcode13-beta3
} | ||
|
||
[Test] | ||
public void DefaultconstructorTest () => Assert.DoesNotThrow (() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: DefaultconstructorTest -> DefaultConstructorTest
src/CoreVideo/CVBuffer.cs
Outdated
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); |
There was a problem hiding this comment.
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)
src/CoreVideo/CVBuffer.cs
Outdated
@@ -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); |
There was a problem hiding this comment.
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.
src/CoreVideo/CVBuffer.cs
Outdated
else | ||
return Runtime.GetNSObject (CVBufferGetAttachment (handle, key.Handle, out attachmentMode)); | ||
return Runtime.GetINativeObject<NSObject> (CVBufferGetAttachment (handle, key.Handle, out attachmentMode), false); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
❌ [PR Build] Tests failed on Build ❌Tests failed on Build. API diff✅ API Diff from stable View API diffAPI & Generator diffℹ️ API Diff (from PR only) (please review changes) GitHub pagesResults can be found in the following github pages (it might take some time to publish): Test results1 tests failed, 107 tests passed.Failed tests
Pipeline on Agent XAMBOT-1096.BigSur' |
❌ [PR Build] Tests failed on Build ❌Tests failed on Build. API diff✅ API Diff from stable View API diffAPI & Generator diffℹ️ API Diff (from PR only) (please review changes) GitHub pagesResults can be found in the following github pages (it might take some time to publish): Test results2 tests failed, 106 tests passed.Failed tests
Pipeline on Agent XAMBOT-1094.BigSur' |
❌ [PR Build] Tests failed on Build ❌Tests failed on Build. API diff✅ API Diff from stable View API diffAPI & Generator diffℹ️ API Diff (from PR only) (please review changes) GitHub pagesResults can be found in the following github pages (it might take some time to publish): Test results2 tests failed, 100 tests passed.Failed tests
Pipeline on Agent XAMBOT-1103.BigSur' |
public bool HasAttachment (NSString key) | ||
{ | ||
if (key == null) | ||
throw new ArgumentNullException (nameof (key)); |
There was a problem hiding this comment.
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));
❌ [PR Build] Tests failed on Build ❌Tests failed on Build. API diff✅ API Diff from stable View API diffAPI & Generator diffℹ️ API Diff (from PR only) (please review changes) GitHub pagesResults can be found in the following github pages (it might take some time to publish): Test results5 tests failed, 97 tests passed.Failed tests
Pipeline on Agent XAMBOT-1098.BigSur' |
❌ [PR Build] Tests failed on Build ❌Tests failed on Build. API diff✅ API Diff from stable View API diffAPI & Generator diffℹ️ API Diff (from PR only) (please review changes) GitHub pagesResults can be found in the following github pages (it might take some time to publish): Test results3 tests failed, 99 tests passed.Failed tests
Pipeline on Agent XAMBOT-1104.BigSur' |
Known issues: #12640 |
No description provided.