mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
Improve process_output
process_output is now to finish processing of the output in async nodes, which means we need to fill the io area before sending the HAVE_OUTPUT event. This simplifies some things and improves performance because we don't need to deal with queues and additional checks.
This commit is contained in:
parent
5b0b9c43d0
commit
f5dbdbc0df
10 changed files with 45 additions and 156 deletions
|
|
@ -61,8 +61,6 @@ struct _V4l2Buffer {
|
|||
bool outstanding;
|
||||
bool allocated;
|
||||
struct v4l2_buffer v4l2_buffer;
|
||||
// V4l2Buffer *next;
|
||||
SpaList list;
|
||||
};
|
||||
|
||||
typedef struct _V4l2Format V4l2Format;
|
||||
|
|
@ -114,7 +112,6 @@ typedef struct {
|
|||
|
||||
V4l2Buffer buffers[MAX_BUFFERS];
|
||||
unsigned int n_buffers;
|
||||
SpaList ready;
|
||||
|
||||
bool source_enabled;
|
||||
SpaSource source;
|
||||
|
|
@ -841,42 +838,6 @@ spa_v4l2_source_node_process_input (SpaNode *node)
|
|||
static SpaResult
|
||||
spa_v4l2_source_node_process_output (SpaNode *node)
|
||||
{
|
||||
SpaV4l2Source *this;
|
||||
SpaV4l2State *state;
|
||||
SpaPortOutput *output;
|
||||
V4l2Buffer *b;
|
||||
|
||||
if (node == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
this = SPA_CONTAINER_OF (node, SpaV4l2Source, node);
|
||||
|
||||
state = &this->state[0];
|
||||
|
||||
if ((output = state->io) == NULL)
|
||||
return SPA_RESULT_OK;
|
||||
|
||||
if (state->current_format == NULL) {
|
||||
output->status = SPA_RESULT_NO_FORMAT;
|
||||
return SPA_RESULT_ERROR;
|
||||
}
|
||||
|
||||
if (spa_list_is_empty (&state->ready)) {
|
||||
output->status = SPA_RESULT_UNEXPECTED;
|
||||
return SPA_RESULT_ERROR;
|
||||
}
|
||||
|
||||
b = spa_list_first (&state->ready, V4l2Buffer, list);
|
||||
if (b == NULL) {
|
||||
output->status = SPA_RESULT_UNEXPECTED;
|
||||
return SPA_RESULT_ERROR;
|
||||
}
|
||||
spa_list_remove (&b->list);
|
||||
b->outstanding = true;
|
||||
|
||||
output->buffer_id = b->outbuf->id;
|
||||
output->status = SPA_RESULT_OK;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
|
|
@ -1034,9 +995,6 @@ v4l2_source_init (const SpaHandleFactory *factory,
|
|||
this->props[1].props.prop_info = prop_info;
|
||||
reset_v4l2_source_props (&this->props[1]);
|
||||
|
||||
spa_list_init (&this->state[0].ready);
|
||||
// SPA_QUEUE_INIT (&this->state[0].ready);
|
||||
|
||||
this->state[0].log = this->log;
|
||||
this->state[0].info.flags = SPA_PORT_INFO_FLAG_LIVE;
|
||||
|
||||
|
|
|
|||
|
|
@ -842,6 +842,7 @@ mmap_read (SpaV4l2Source *this)
|
|||
V4l2Buffer *b;
|
||||
SpaData *d;
|
||||
int64_t pts;
|
||||
SpaPortOutput *output;
|
||||
|
||||
CLEAR(buf);
|
||||
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
|
|
@ -880,8 +881,11 @@ mmap_read (SpaV4l2Source *this)
|
|||
d[0].chunk->size = buf.bytesused;
|
||||
d[0].chunk->stride = state->fmt.fmt.pix.bytesperline;
|
||||
|
||||
spa_list_insert (state->ready.prev, &b->list);
|
||||
|
||||
if ((output = state->io)) {
|
||||
b->outstanding = true;
|
||||
output->buffer_id = b->outbuf->id;
|
||||
output->status = SPA_RESULT_OK;
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue