-
Notifications
You must be signed in to change notification settings - Fork 621
C# Record and Playback APIs #822
base: develop
Are you sure you want to change the base?
Conversation
…ensor-SDK into csharp-record
…ensor-SDK into csharp-record
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.
Wow that is a lot of exception handling. There is a ton of code here. You might also have Derek take a peek
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU |
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.
Not sure the best way to deal with this. The "Any CPU" in the solution can get confusing, but Visual Studio really likes adding it back in.
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'm not sure here either. Not supporting Any CPU in the nuget package is also pretty rough since downstream projects tend to have it by 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.
I thought we did have an issue tracking Any CPU support but I can't find it at this moment.
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.
.NET Core can actually do AnyCPU here. It's able to handle multiple native libraries with different architectures by deploying the native libs in the \runtimes\win-x64\
and \runtimes\win-x86\
sub folders.
@@ -0,0 +1,102 @@ | |||
using System; |
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.
Copyright header.
src/csharp/Record/Exceptions/AzureKinectCreateRecordingException.cs
Outdated
Show resolved
Hide resolved
…on.cs Co-Authored-By: Derek M. <[email protected]>
} | ||
|
||
/// <summary> | ||
/// Gets get the camera calibration for Azure Kinect device used during recording. The output struct is used as input to all transformation functions. |
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.
There are many places in the file where you have "Gets get", you can remove the duplicate "get".
UIntPtr size = new UIntPtr(0); | ||
if (NativeMethods.k4a_playback_get_raw_calibration(this.handle, null, ref size) != NativeMethods.k4a_buffer_result_t.K4A_BUFFER_RESULT_TOO_SMALL) | ||
{ | ||
throw new AzureKinectGetRawCalibrationException($"Unexpected result calling {nameof(NativeMethods.k4a_playback_get_raw_calibration)}"); |
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.
If I understand the code correctly, this will throw if there is no calibration, however the exception will just say unexpected result. Can we add logging in here? Or somehow return a better result for when the calibration doesn't exist?
case NativeMethods.k4a_stream_result_t.K4A_STREAM_RESULT_EOF: | ||
return null; | ||
case NativeMethods.k4a_stream_result_t.K4A_STREAM_RESULT_FAILED: | ||
throw new AzureKinectGetCaptureException(); |
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.
It might be nice to get the log here for this expcetion.
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.
And the other similar functions, GetPreviousCapture, GetNextImuSample, GetPreviousImuSample, etc
/// Azure Kinect objects. | ||
/// | ||
/// When using this handle value, the caller is responsible for ensuring that the | ||
/// Device object does not become disposed.</remarks> |
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.
Would you want to add that locking on this object will gaurentee that it isn't disposed while you are using the handle?
/// <returns>The native handle that is wrapped by this device.</returns> | ||
/// <remarks>The function is dangerous because there is no guarantee that the | ||
/// handle will not be disposed once it is retrieved. This should only be called | ||
/// by code that can ensure that the Capture object will not be disposed on another |
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.
/// by code that can ensure that the Capture object will not be disposed on another | |
/// by code that can ensure that the Device object will not be disposed on another |
@@ -47,6 +48,19 @@ public static class Logger | |||
} | |||
} | |||
|
|||
private static event Action<LogMessage> LogMessageHandlers; |
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.
Did StyleCop not require this to be before the public one?
} | ||
} | ||
|
||
private static event Action<LogMessage> LogMessageHandlers; |
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.
Did StyleCop not require this to be before the Public one?
@@ -373,7 +380,10 @@ k4a_result_t k4a_record_add_tag(const k4a_record_t recording_handle, const char | |||
return K4A_RESULT_FAILED; | |||
} | |||
|
|||
add_tag(context, name, value); | |||
if (NULL == add_tag(context, name, value)) |
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.
Out of scope for this review, but do we need to care about the return value from any of the other add_tag calls?
@@ -0,0 +1,216 @@ | |||
using System; |
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.
Copyright header.
record.AddTag("MYTAG1", "one"); | ||
record.AddTag("MYTAG2", "two"); | ||
|
||
record.WriteHeader(); |
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.
You have a comment that WriteHeader must be called before any data is written, but does it need to be called after all tracks and tags are added?
|
||
// Not captured in recording | ||
// Assert.AreEqual(100, c.Color.ISOSpeed); | ||
Assert.AreEqual(0, c.Color.SystemTimestampNsec); |
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.
Why is this 0? Didn't you write the timestamp in above?
any updates on this? would be greatly appreciated 😺 |
really hoping this makes it in the v.1.4.0 release, waiting on this to develop some new features in my Unity3D project |
What is the reason this pull request is stopped? Thanks, |
They mentioned in a comment on #1093 that they're working through some technical issues. I'm guessing they're probably working through any minor bugs on the 1.4 release as that was a pretty big one. They haven't forgotten about it 🙃 You can always build this branch or copy in the needed code to you project if you really need. |
bumping. i know it won't get missed, mainly wondering if it has a tentative date. didn't know if there was a normal release cadence or it's just as things get merged. if it'll be a while i'll just roll my own, wrapper - now with less quality!™️ :) anything i can do to help on this? |
Re-bumping this. |
Hi, |
I know this is sort of stalled, but I just wanted to comment that I have been using this branch now for a while to implement playback and recording inside of a Unity project I am working on and everything has been working like a charm. Thanks for this work! |
According to the C++ code here: https://github.com/microsoft/Azure-Kinect-Sensor-SDK/blob/develop/src/record/sdk/record.cpp#L85 The ColorFormat |
I see my error here. This branch is actually using older C++ code that doesn't support that color format. |
Fixes #573
Description of the changes:
Before submitting a Pull Request:
I tested changes on: