mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
parent
938e2b1451
commit
e0580fedc1
2 changed files with 24 additions and 8 deletions
|
|
@ -30,6 +30,11 @@
|
||||||
#define FLAG_SEEKMASK 0x000000FFLU
|
#define FLAG_SEEKMASK 0x000000FFLU
|
||||||
#define FLAG_SHMWRITABLE 0x00800000LU
|
#define FLAG_SHMWRITABLE 0x00800000LU
|
||||||
|
|
||||||
|
#define SEEK_RELATIVE 0
|
||||||
|
#define SEEK_ABSOLUTE 1
|
||||||
|
#define SEEK_RELATIVE_ON_READ 2
|
||||||
|
#define SEEK_RELATIVE_END 3
|
||||||
|
|
||||||
#define FRAME_SIZE_MAX_ALLOW (1024*1024*16)
|
#define FRAME_SIZE_MAX_ALLOW (1024*1024*16)
|
||||||
|
|
||||||
#define PROTOCOL_FLAG_MASK 0xffff0000u
|
#define PROTOCOL_FLAG_MASK 0xffff0000u
|
||||||
|
|
|
||||||
|
|
@ -4754,17 +4754,12 @@ static int handle_memblock(struct client *client, struct message *msg)
|
||||||
offset = (int64_t) (
|
offset = (int64_t) (
|
||||||
(((uint64_t) ntohl(client->desc.offset_hi)) << 32) |
|
(((uint64_t) ntohl(client->desc.offset_hi)) << 32) |
|
||||||
(((uint64_t) ntohl(client->desc.offset_lo))));
|
(((uint64_t) ntohl(client->desc.offset_lo))));
|
||||||
flags = ntohl(client->desc.flags) & FLAG_SEEKMASK;
|
flags = ntohl(client->desc.flags);
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: Received memblock channel:%d offset:%"PRIi64
|
pw_log_debug(NAME" %p: Received memblock channel:%d offset:%"PRIi64
|
||||||
" flags:%08x size:%u", impl, channel, offset,
|
" flags:%08x size:%u", impl, channel, offset,
|
||||||
flags, msg->length);
|
flags, msg->length);
|
||||||
|
|
||||||
if (flags != 0)
|
|
||||||
pw_log_warn(NAME" %p: unhandled seek flags:%02x", impl, flags);
|
|
||||||
if (offset != 0)
|
|
||||||
pw_log_warn(NAME" %p: unhandled offset:%08"PRIx64, impl, offset);
|
|
||||||
|
|
||||||
stream = pw_map_lookup(&client->streams, channel);
|
stream = pw_map_lookup(&client->streams, channel);
|
||||||
if (stream == NULL || stream->type == STREAM_TYPE_RECORD) {
|
if (stream == NULL || stream->type == STREAM_TYPE_RECORD) {
|
||||||
res = -EINVAL;
|
res = -EINVAL;
|
||||||
|
|
@ -4772,8 +4767,24 @@ static int handle_memblock(struct client *client, struct message *msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
filled = spa_ringbuffer_get_write_index(&stream->ring, &index);
|
filled = spa_ringbuffer_get_write_index(&stream->ring, &index);
|
||||||
pw_log_debug("new block %p %p/%u filled:%d index:%d", msg,
|
pw_log_debug("new block %p %p/%u filled:%d index:%d flags:%02x offset:%08"PRIx64,
|
||||||
msg->data, msg->length, filled, index);
|
msg, msg->data, msg->length, filled, index, flags, offset);
|
||||||
|
|
||||||
|
switch (flags & FLAG_SEEKMASK) {
|
||||||
|
case SEEK_RELATIVE:
|
||||||
|
index += offset;
|
||||||
|
filled -= offset;
|
||||||
|
break;
|
||||||
|
case SEEK_ABSOLUTE:
|
||||||
|
filled -= (int32_t)(offset - (uint64_t)index);
|
||||||
|
index = offset;
|
||||||
|
break;
|
||||||
|
case SEEK_RELATIVE_ON_READ:
|
||||||
|
case SEEK_RELATIVE_END:
|
||||||
|
index = index - filled + offset;
|
||||||
|
filled = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (filled < 0) {
|
if (filled < 0) {
|
||||||
/* underrun, reported on reader side */
|
/* underrun, reported on reader side */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue