remove the rate_match io

Now that the stream provides us with a requested size, we don't need to
use the rate_match anymore.
This commit is contained in:
Wim Taymans 2022-03-29 09:18:18 +02:00
parent 5192fcb16c
commit 7e42c905a8
8 changed files with 12 additions and 104 deletions

View file

@ -1260,8 +1260,7 @@ static void stream_process(void *data)
if (stream->direction == PW_DIRECTION_OUTPUT) {
int32_t avail = spa_ringbuffer_get_read_index(&stream->ring, &index);
if (stream->rate_match)
minreq = stream->rate_match->size * stream->frame_size;
minreq = buffer->requested * stream->frame_size;
if (minreq == 0)
minreq = stream->attr.minreq;

View file

@ -61,17 +61,6 @@ static void sample_play_stream_state_changed(void *data, enum pw_stream_state ol
}
}
static void sample_play_stream_io_changed(void *data, uint32_t id, void *area, uint32_t size)
{
struct sample_play *p = data;
switch (id) {
case SPA_IO_RateMatch:
p->rate_match = area;
break;
}
}
static void sample_play_stream_destroy(void *data)
{
struct sample_play *p = data;
@ -111,8 +100,8 @@ static void sample_play_stream_process(void *data)
return;
size = SPA_MIN(size, buf->datas[0].maxsize);
if (p->rate_match)
size = SPA_MIN(size, p->rate_match->size * p->stride);
if (b->requested)
size = SPA_MIN(size, b->requested * p->stride);
memcpy(d, s->buffer + p->offset, size);
@ -135,7 +124,6 @@ static void sample_play_stream_drained(void *data)
static const struct pw_stream_events sample_play_stream_events = {
PW_VERSION_STREAM_EVENTS,
.state_changed = sample_play_stream_state_changed,
.io_changed = sample_play_stream_io_changed,
.destroy = sample_play_stream_destroy,
.process = sample_play_stream_process,
.drained = sample_play_stream_drained,

View file

@ -37,7 +37,6 @@ struct pw_loop;
struct pw_stream;
struct pw_context;
struct pw_properties;
struct spa_io_rate_match;
struct sample_play_events {
#define VERSION_SAMPLE_PLAY_EVENTS 0
@ -55,7 +54,6 @@ struct sample_play {
struct spa_list link;
struct sample *sample;
struct pw_stream *stream;
struct spa_io_rate_match *rate_match;
uint32_t id;
struct spa_hook listener;
struct pw_context *context;