-
-
Notifications
You must be signed in to change notification settings - Fork 459
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
173 additions
and
89 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
Assets/MediaPipe/SDK/Scripts/Core/MediaPipePluginException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using System; | ||
|
||
namespace Mediapipe { | ||
public class MediaPipePluginException : ApplicationException { | ||
public MediaPipePluginException(string message) : base(message) {} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...tiveMethods/Framework/Packet_Safe.cs.meta → ...pts/Core/MediaPipePluginException.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,27 @@ | ||
namespace Mediapipe { | ||
public enum MpReturnCode : int { | ||
Success = 0, | ||
/// <summary>A standard exception is thrown</summary> | ||
StandardError = 1, | ||
UnknownError = 2, | ||
/// <summary>Something other than standard exception is thrown</summary> | ||
UnknownError = 70, | ||
/// <summary>SDK failed to set status code (bug)</summary> | ||
Unset = 128, // | ||
/// <summary>Received SIGABRT</summary> | ||
Aborted = 134, | ||
} | ||
|
||
public static class MpReturnCodeExtension { | ||
public static void Assert(this MpReturnCode code) { | ||
if (code == MpReturnCode.Success) { | ||
return; | ||
switch (code) { | ||
case MpReturnCode.Success: return; | ||
case MpReturnCode.Aborted: { | ||
throw new MediaPipeException("MediaPipe Aborted, refer glog files for more details"); | ||
} | ||
default: { | ||
throw new MediaPipePluginException($"Failed to call a native function (code={code}"); | ||
} | ||
} | ||
|
||
throw new MediaPipeException($"Failed to call a native method (code={code})"); | ||
} | ||
} | ||
} |
11 changes: 0 additions & 11 deletions
11
Assets/MediaPipe/SDK/Scripts/PInvoke/NativeMethods/Framework/Packet_Safe.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "mediapipe_api/common.h" | ||
|
||
namespace { | ||
thread_local struct sigaction orig_act; | ||
thread_local sigjmp_buf abrt_jbuf; | ||
|
||
void sigabrt_handler(int sig) { | ||
siglongjmp(abrt_jbuf, 1); | ||
} | ||
} | ||
|
||
bool sigabrt_is_not_received() { | ||
return sigsetjmp(abrt_jbuf, 1) == 0; | ||
} | ||
|
||
void setup_sigaction() { | ||
struct sigaction act; | ||
|
||
sigemptyset(&act.sa_mask); | ||
act.sa_flags = 0; | ||
act.sa_handler = sigabrt_handler; | ||
|
||
sigaction(SIGABRT, &act, &orig_act); | ||
} | ||
|
||
void restore_sigaction() { | ||
sigaction(SIGABRT, &orig_act, nullptr); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.