BililiveRecorder/test/BililiveRecorder.Flv.UnitTests/TestRecyclableMemoryStreamProvider.cs

31 lines
1019 B
C#
Raw Normal View History

2021-02-23 18:03:37 +08:00
using System.Diagnostics;
2021-02-08 16:51:19 +08:00
using System.IO;
using Microsoft.IO;
namespace BililiveRecorder.Flv.UnitTests
{
public class TestRecyclableMemoryStreamProvider : IMemoryStreamProvider
{
private static readonly RecyclableMemoryStreamManager manager
= new RecyclableMemoryStreamManager(32 * 1024, 64 * 1024, 64 * 1024 * 32)
{
MaximumFreeSmallPoolBytes = 64 * 1024 * 1024,
MaximumFreeLargePoolBytes = 64 * 1024 * 32,
};
2021-02-23 18:03:37 +08:00
static TestRecyclableMemoryStreamProvider()
{
2021-05-01 00:41:31 +08:00
//manager.StreamFinalized += (sender, e) =>
//{
// Debug.WriteLine("TestRecyclableMemoryStreamProvider: Stream Finalized");
//};
//manager.StreamDisposed += (sender, e) =>
//{
// // Debug.WriteLine("TestRecyclableMemoryStreamProvider: Stream Disposed");
//};
2021-02-23 18:03:37 +08:00
}
2021-02-08 16:51:19 +08:00
public Stream CreateMemoryStream(string tag) => manager.GetStream(tag);
}
}