Code: Select all
num = mmal_queue_length(state.camera_pool->queue);
for (q=0;q<num;q++)
{
MMAL_BUFFER_HEADER_T *buffer = mmal_queue_get(state.camera_pool->queue);
if (!buffer)
vcos_log_error("Unable to get a required buffer %d from pool queue", q);
if (mmal_port_send_buffer(camera_still_port, buffer)!= MMAL_SUCCESS)
vcos_log_error("Unable to send a buffer to camera output port (%d)", q);
}
Code: Select all
mmal_buffer_header_release(buffer);
// and send one back to the port (if still open)
if (!port->is_enabled)
return;
new_buffer = mmal_queue_get(pool->queue);
if (new_buffer)
status = mmal_port_send_buffer(port, new_buffer);
if (!new_buffer || status != MMAL_SUCCESS)
printf("Unable to return a buffer to the encoder port. \n");
I have identical code, but instead of using opaque buffers and connecting the camera's video port to the encoder, I'm using yuv encoding and taking the output straight from the video port. I would think that it would all work in a similar way, but that first snippet of code doesn't quite work.
Code: Select all
for (i=0;i<queue_length;i++){
printf ("Sending buffer %i/%i...\n", i+1, queue_length);
buffer = mmal_queue_get(pool->queue);
if (!buffer)
printf("Unable to get a required buffer %d from pool queue.\n", i);
status = mmal_port_send_buffer(camera->output[MMAL_CAMERA_VIDEO_PORT], buffer);
if (status != MMAL_SUCCESS)
printf("Unable to send a buffer to encoder output port (%d): error %d\n", i, status);
}
What's the issue? In both cases, I'm sending three buffers to a port, yet I get ENOMEM here. I have lots of free ARM and GPU memory, so I don't believe that's the issue.Sending buffer 1/3...
Sending buffer 2/3...
mmal: mmal_port_send_buffer: vc.ril.camera:out:1(I420): send failed: ENOMEM
Unable to send a buffer to video output port (1): error 1
Sending buffer 3/3...
mmal: mmal_port_send_buffer: vc.ril.camera:out:1(I420): send failed: ENOMEM
Unable to send a buffer to video output port (2): error 1
