Skip to content

Commit 46fb463

Browse files
authored
Merge pull request #581 from rosenbjerg/include-more-guid-chars-in-pipe-path
Include more guid chars in pipe path
2 parents cf775ae + 77d13e8 commit 46fb463

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

FFMpegCore.Test/ArgumentBuilderTest.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
using System.Drawing;
22
using FFMpegCore.Arguments;
33
using FFMpegCore.Enums;
4+
using FFMpegCore.Pipes;
45

56
namespace FFMpegCore.Test;
67

78
[TestClass]
89
public class ArgumentBuilderTest
910
{
1011
private readonly string[] _concatFiles = { "1.mp4", "2.mp4", "3.mp4", "4.mp4" };
12+
private readonly int _macOsMaxPipePathLength = 104;
1113
private readonly string[] _multiFiles = { "1.mp3", "2.mp3", "3.mp3", "4.mp3" };
1214

1315
[TestMethod]
@@ -703,4 +705,18 @@ public void Audible_Aax_Test()
703705
var arg = new AudibleEncryptionKeyArgument("62689101");
704706
Assert.AreEqual("-activation_bytes 62689101", arg.Text);
705707
}
708+
709+
[TestMethod]
710+
public void InputPipe_MaxLength_ShorterThanMacOSMax()
711+
{
712+
var pipePath = new InputPipeArgument(new StreamPipeSource(Stream.Null)).PipePath;
713+
Assert.IsLessThan(104, pipePath.Length);
714+
}
715+
716+
[TestMethod]
717+
public void OutputPipe_MaxLength_ShorterThanMacOSMax()
718+
{
719+
var pipePath = new OutputPipeArgument(new StreamPipeSink(Stream.Null)).PipePath;
720+
Assert.IsLessThan(_macOsMaxPipePathLength, pipePath.Length);
721+
}
706722
}

FFMpegCore/FFMpeg/Arguments/PipeArgument.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public abstract class PipeArgument
1111

1212
protected PipeArgument(PipeDirection direction)
1313
{
14-
PipeName = PipeHelpers.GetUnqiuePipeName();
14+
PipeName = PipeHelpers.GetUniquePipeName();
1515
_direction = direction;
1616
}
1717

FFMpegCore/FFMpeg/Pipes/PipeHelpers.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ namespace FFMpegCore.Pipes;
44

55
internal static class PipeHelpers
66
{
7-
public static string GetUnqiuePipeName()
7+
public static string GetUniquePipeName()
88
{
9-
return $"FFMpegCore_{Guid.NewGuid().ToString("N").Substring(0, 5)}";
9+
return $"FFMpegCore_{Guid.NewGuid().ToString("N").Substring(0, 16)}";
1010
}
1111

1212
public static string GetPipePath(string pipeName)

0 commit comments

Comments
 (0)