mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-16 08:56:45 -05:00
Fix stream restart
Make sure we always send a clock update before sending a start command. Fix memory size. Follow the state of the node to do allocation Use the pinos node to control the state When doing STREAMOFF, all buffers will be dequeued. requeue them buffers for when we go to playing again.
This commit is contained in:
parent
e34ef88dac
commit
021eccb8ad
7 changed files with 107 additions and 63 deletions
|
|
@ -862,6 +862,13 @@ v4l2_on_fd_events (SpaPollNotifyData *data)
|
|||
SpaNodeEvent event;
|
||||
SpaNodeEventHaveOutput ho;
|
||||
|
||||
if (data->fds[0].revents & POLLERR) {
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (mmap_read (this) < 0)
|
||||
return 0;
|
||||
|
||||
|
|
@ -1171,22 +1178,31 @@ spa_v4l2_pause (SpaV4l2Source *this)
|
|||
SpaV4l2State *state = &this->state[0];
|
||||
enum v4l2_buf_type type;
|
||||
SpaNodeEvent event;
|
||||
int i;
|
||||
|
||||
if (!state->started)
|
||||
return SPA_RESULT_OK;
|
||||
|
||||
state->started = false;
|
||||
|
||||
event.type = SPA_NODE_EVENT_TYPE_REMOVE_POLL;
|
||||
event.data = &state->poll;
|
||||
event.size = sizeof (state->poll);
|
||||
this->event_cb (&this->node, &event, this->user_data);
|
||||
|
||||
state->started = false;
|
||||
|
||||
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
if (xioctl (state->fd, VIDIOC_STREAMOFF, &type) < 0) {
|
||||
perror ("VIDIOC_STREAMOFF");
|
||||
return SPA_RESULT_ERROR;
|
||||
}
|
||||
for (i = 0; i < state->reqbuf.count; i++) {
|
||||
V4l2Buffer *b;
|
||||
|
||||
b = &state->alloc_buffers[i];
|
||||
if (!b->outstanding)
|
||||
if (xioctl (state->fd, VIDIOC_QBUF, &b->v4l2_buffer) < 0)
|
||||
perror ("VIDIOC_QBUF");
|
||||
}
|
||||
update_state (this, SPA_NODE_STATE_PAUSED);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue