summaryrefslogtreecommitdiff
path: root/src/buffer
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2024-12-26 11:25:14 -0500
committerAndrew Opalach <andrew@akon.city> 2024-12-26 11:25:14 -0500
commit9026e7f49f11e920eac666bd4159ec459b979623 (patch)
tree999ae6fdf5ea4dbad5e777818a176a6b2d564553 /src/buffer
parent7021f0625cc018af58d61d7875fbeb21b64d99bf (diff)
downloadcamu-9026e7f49f11e920eac666bd4159ec459b979623.tar.gz
camu-9026e7f49f11e920eac666bd4159ec459b979623.tar.bz2
camu-9026e7f49f11e920eac666bd4159ec459b979623.zip
Incomplete buffer errored and sink queued
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/buffer')
-rw-r--r--src/buffer/common.h3
-rw-r--r--src/buffer/common_internal.h4
-rw-r--r--src/buffer/video.c5
3 files changed, 10 insertions, 2 deletions
diff --git a/src/buffer/common.h b/src/buffer/common.h
index 64168ff..24964ba 100644
--- a/src/buffer/common.h
+++ b/src/buffer/common.h
@@ -5,5 +5,6 @@ enum {
CAMU_BUFFER_CORK,
CAMU_BUFFER_UNCORK,
CAMU_BUFFER_PAUSED,
- CAMU_BUFFER_EOF
+ CAMU_BUFFER_EOF,
+ CAMU_BUFFER_ERRORED
};
diff --git a/src/buffer/common_internal.h b/src/buffer/common_internal.h
index 0dc1e5f..e4cdd33 100644
--- a/src/buffer/common_internal.h
+++ b/src/buffer/common_internal.h
@@ -6,5 +6,7 @@ enum {
// Got request to flush.
FLUSHED,
// Realized flush.
- SIGNALED
+ SIGNALED,
+ // Errored.
+ ERRORED
};
diff --git a/src/buffer/video.c b/src/buffer/video.c
index 2879082..94c452d 100644
--- a/src/buffer/video.c
+++ b/src/buffer/video.c
@@ -237,6 +237,11 @@ bool camu_video_buffer_read(struct camu_video_buffer *buf, void *out)
}
u8 ret = buf->queue->read(buf->queue, base, out);
u8 flow = al_atomic_load(u8)(&buf->flow, AL_ATOMIC_ACQUIRE);
+ if (ret == CAMU_QUEUE_ERR) {
+ buf->callback(buf->userdata, CAMU_BUFFER_ERRORED);
+ al_atomic_store(u8)(&buf->flow, ERRORED, AL_ATOMIC_RELEASE);
+ return false;
+ }
if (flow == FLUSHED && (ret == CAMU_QUEUE_EOF || (buf->single_frame && ret == CAMU_QUEUE_OK))) {
buf->callback(buf->userdata, CAMU_BUFFER_EOF);
al_atomic_store(u8)(&buf->flow, SIGNALED, AL_ATOMIC_RELEASE);