setSourceClipRect causing IBufferOutputStream::acquireBuffer() to hang?

Hi there,
I’ve stumbeld over some really odd behaviour that I thought is worth bringing up here.
We’re building an application that records streams of attached cameras to compressed video files, using Argus and the multimedia framework on a Jetson Xavier.
All works well until I make use of a specific feature, setting the clip rectangle to define the relevant image area to record using setSourceClipRect().
Let’s say we have a sensor delivering 1936x1100 and we want to crop out the inner 1920x1080 pixels (btw. it’s a shame that we can’t just drop pixels on the edges), I calculate the source clip rectangle to be ~ (0.004132, 0.009091, 0.995868, 0.990909). I pass it to the function, it returns STATUS_OK and everything looks fine until I try to acquire a buffer, which hangs forever.
Now the funny thing is that if I take a value with a lower float resolution, it seems to work fine: (0.004, 0.009, 0.996, 0.991) works nicely. I tried just rounding the precision and it works, but only for some clipping numbers, eg it wouldn’t work for clipping 1920x640.
I suspect it might be that the resulting stream size has to be even or something like this?

Anyway, would be great if this would be just working. I want to mention that this happens only when using STREAM_TYPE_BUFFER & BUFFER_TYPE_EGL_IMAGE, I had no such problems when using STREAM_TYPE_EGL and acquired the images using a frame consumer.

Your help is much appreciated.

Regards,
Konstantin Kohl

Just configure your output streaming as 1080p then the camera framework will help to get the 1920x1080 output.

iStreamSettings->setResolution()

Hi Shane,
thanks for your reply. I’m not sure if I understand your proposed solution, though. as I wrote, I use the buffer stream type, which doesn’t have the setResolution function in it’s interface.

Best,
Konstantin

The streaming setting are must have function. There’s no reason don’t have setresolution.

So I’m looking at what the API offers me:

setResolution() exists only as a member of IEGLOutputStreamSettings. No other class or interface in the Argus API has it.
I’m using a buffer output stream, and the only settings interface available to me is IBufferOutputStreamSettings. I actually tried acquiring the IEGLOutputStreamSettings interface, but the cast failed (as I would expect it). So it looks like this function won’t work for me and I need to use the clip rectangle (available on the IStreamSettings interface), but this is broken as I described in my original post.

Any ideas?

Any update on this? Maybe I’m really getting something very wrong here?

Could you check the sample code if have the same problem? It could be your clip rectangle have problem.

./samples/denoise/main.cpp:static const Rectangle SOURCE_CLIP_RECT (0.4f, 0.4f, 0.6f, 0.6f);
./samples/denoise/main.cpp: previewStreamSettings->setSourceClipRect(SOURCE_CLIP_RECT);
./samples/denoise/main.cpp: denoiseStreamSettings->setSourceClipRect(SOURCE_CLIP_RECT);

I wasn’t able to reproduce the issue in the denoise sample. This doesn’t surprise me, as this sample uses STREAM_TYPE_EGL, which worked fine also for me, as I wrote in the original post.

BUT I managed to nicely repro the issue in the eglimage sample, which uses a buffer output stream! I just added the creation of the source clip rectangle in the proper place, and when I start the sample with a capture resolution of 1920x1080, it freezes in the startup. You can find my changed sample here:
main.cpp (16.4 KB)
The changes I did are marked with

// BEGIN YAAK repro clip rect issue
and
// END YAAK repro clip rect issue

It’s important to start the sample with 1920x1080 resolution. I suspect it is also important that the sensor delivers a slightly higher resolution than 1920x1080. I’m using a D3 Engineering D3RCM-IMX390-953, which is built around the Sony IMX390 image sensor, which delivers a native resolution of 1936x1100.

I hope this information helps us tracking down this issue!

Best, Konstantin

Looks like you are reference to the eglImage.
I think you can set modify the windows to 1920x1080 to have argus internal logic to output 1920x1080

static const Argus::Rectangle<uint32_t> DEFAULT_WINDOW_RECT(0, 0, 1024, 768);
./samples/utils/CommonOptions.cpp