While working on the input port in #176, I set up a test which seems to crash during shutdown -- without using the port I've been working on. I thought it was the port, I finally disabled every bit of it except the constructors, then I removed the use of the new port altogether and it still hangs. CTRL+C still exits but I can't run my test program after that without rebooting.
The pipeline is below in case you want to take a look -- splitter, ISP resizer to h.264 to video stream capture, and no resizer on the other splitter out, just h.264 to video stream capture. Camera is in mode 2 (1920 x 1080). Maybe it's more config restrictions I'm messing up, I don't know. The end of the log where it hangs is also below -- it's usually that exact point, disconnecting ISP from the encoder (or whatever comes next), but not always -- I suspect due to a race condition and the log output doesn't always make it to storage.
using (var capture = new VideoStreamCaptureHandler(ramdiskPath + "small.h264"))
using (var capture2 = new VideoStreamCaptureHandler(ramdiskPath + "fullsize.h264"))
using (var splitter = new MMALSplitterComponent())
using (var resizer = new MMALIspComponent())
using (var encoder = new MMALVideoEncoder())
using (var encoder2 = new MMALVideoEncoder())
{
var camConfig = new MMALPortConfig(MMALEncoding.OPAQUE, MMALEncoding.I420, width: 1920, height: 1080);
var rawConfig = new MMALPortConfig(MMALEncoding.RGB24, MMALEncoding.RGB24, width: 1920, height: 1080);
var resizedConfig = new MMALPortConfig(MMALEncoding.RGB24, MMALEncoding.RGB24, width: 640, height: 480);
var h264Config = new MMALPortConfig(MMALEncoding.H264, MMALEncoding.I420, quality: 10, bitrate: MMALVideoEncoder.MaxBitrateLevel4);
splitter.ConfigureInputPort(camConfig, cam.Camera.VideoPort, null);
splitter.ConfigureOutputPort(rawConfig, null);
resizer.ConfigureInputPort(rawConfig, null, null);
encoder.ConfigureInputPort(resizedConfig, null);
encoder2.ConfigureInputPort(rawConfig, null);
resizer.ConfigureOutputPort(resizedConfig, null);
encoder.ConfigureOutputPort(h264Config, capture);
encoder2.ConfigureOutputPort(h264Config, capture2);
splitter.Outputs[0].ConnectTo(resizer);
resizer.Outputs[0].ConnectTo(encoder);
splitter.Outputs[1].ConnectTo(encoder2);
cam.Camera.VideoPort.ConnectTo(splitter);
await Task.Delay(2000);
var cts = new CancellationTokenSource(TimeSpan.FromSeconds(totalSeconds));
await cam.ProcessAsync(cam.Camera.VideoPort, cts.Token);
}
cam.Cleanup();
While working on the input port in #176, I set up a test which seems to crash during shutdown -- without using the port I've been working on. I thought it was the port, I finally disabled every bit of it except the constructors, then I removed the use of the new port altogether and it still hangs. CTRL+C still exits but I can't run my test program after that without rebooting.
The pipeline is below in case you want to take a look -- splitter, ISP resizer to h.264 to video stream capture, and no resizer on the other splitter out, just h.264 to video stream capture. Camera is in mode 2 (1920 x 1080). Maybe it's more config restrictions I'm messing up, I don't know. The end of the log where it hangs is also below -- it's usually that exact point, disconnecting ISP from the encoder (or whatever comes next), but not always -- I suspect due to a race condition and the log output doesn't always make it to storage.