summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/main.c b/main.c
index 8676a14..4eb43b0 100644
--- a/main.c
+++ b/main.c
@@ -124,11 +124,15 @@ static void OnAudioContextAudioReady(void* user, const void* buffer,
struct Contexts* contexts = user;
if (contexts->client_fd == -1) return;
+ // TODO(mburakov): Stride must be calculated from commandline arguments!
+ static const size_t stride = sizeof(int16_t) * 2;
+ size_t latency = MIN(size / stride, UINT16_MAX);
+
struct Proto proto = {
.size = (uint32_t)size,
.type = PROTO_TYPE_AUDIO,
.flags = 0,
- .latency = 0, // TODO(mburakov): Implement this!
+ .latency = (uint16_t)latency,
};
if (!WriteProto(contexts->client_fd, &proto, buffer)) {
LOG("Failed to write audio frame");