Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Hangs disabling connections #178

Open
MV10 opened this issue Sep 4, 2020 · 0 comments
Open

Hangs disabling connections #178

MV10 opened this issue Sep 4, 2020 · 0 comments

Comments

@MV10
Copy link
Collaborator

MV10 commented Sep 4, 2020

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();
2020-09-04 15:55:09.522 -04:00 [DBG] 
 Buffer Header 
---------------- 
Length: 42757 
Presentation Timestamp: -9223372036854775808 
Flags: 
MMAL_BUFFER_HEADER_FLAG_FRAME_END 
MMAL_BUFFER_HEADER_FLAG_NAL 
---------------- 

2020-09-04 15:55:09.522 -04:00 [DBG] Releasing buffer.
2020-09-04 15:55:09.522 -04:00 [DBG] Releasing buffer.
2020-09-04 15:55:09.523 -04:00 [DBG] vc.ril.video_encode:out:0(H264): Timeout exceeded, triggering signal.
2020-09-04 15:55:09.523 -04:00 [DBG] vc.ril.video_encode:out:0(H264): Timeout exceeded, triggering signal.
2020-09-04 15:55:09.531 -04:00 [DBG] Setting parameter MMAL_PARAMETER_CAPTURE
2020-09-04 15:55:09.537 -04:00 [DBG] Disabling connection between vc.ril.video_splitter and vc.ril.isp
2020-09-04 15:55:09.537 -04:00 [DBG] Disabling connection between vc.ril.isp and vc.ril.video_encode
2020-09-04 15:55:09.538 -04:00 [DBG] Disabling connection between vc.ril.isp:out:0(RGB3) and vc.ril.video_encode:in:0(RGB3)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant