Add TCP tunnel fallback for stream proof
This commit is contained in:
parent
85d021faef
commit
477d421dbf
4 changed files with 69 additions and 12 deletions
|
|
@ -112,7 +112,7 @@ namespace Mimir {
|
|||
}
|
||||
|
||||
public static void Capture(string outputPath, double seconds, int targetRate, int targetChannels, string roleName) {
|
||||
Stream output = outputPath == "-" ? Console.OpenStandardOutput() : new FileStream(outputPath, FileMode.Create, FileAccess.Write, FileShare.Read);
|
||||
Stream output = IsStdoutPath(outputPath) ? Console.OpenStandardOutput() : new FileStream(outputPath, FileMode.Create, FileAccess.Write, FileShare.Read);
|
||||
try {
|
||||
IMMDeviceEnumerator enumerator = (IMMDeviceEnumerator)(new MMDeviceEnumerator());
|
||||
IMMDevice device;
|
||||
|
|
@ -216,10 +216,15 @@ namespace Mimir {
|
|||
}
|
||||
}
|
||||
finally {
|
||||
if (outputPath != "-") output.Dispose();
|
||||
if (!IsStdoutPath(outputPath)) output.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
static bool IsStdoutPath(string outputPath) {
|
||||
return String.Equals(outputPath, "-", StringComparison.Ordinal) ||
|
||||
String.Equals(outputPath, "stdout", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
static void Check(int hr, string stage) {
|
||||
if (hr < 0) {
|
||||
Exception inner = Marshal.GetExceptionForHR(hr);
|
||||
|
|
|
|||
Loading…
Reference in a new issue