ReviewOS

also looking at this

home-lang/home

feat(media): add bounded PCM capture, owned snapshots and A/V streaming

#917
Merged chris wants to merge feat/pcm-av-streaming into main
11 files +683 -0
packages/audio/src/io/native_capture_test.cadded+16-0
Changes to packages/audio/src/io/native_capture_test.c
@@ -0,0 +1,16 @@
1#include "native_capture.h"
2#include <assert.h>
3#include <stdint.h>
4#include <stddef.h>
5int main(void) {
6 home_capture_config cfg={48000,2,480};
7 home_audio_capture *capture=NULL;
8 assert(home_audio_open(&cfg,"null",&capture)==0);
9 uint8_t bytes[1920];uint32_t frames=0;uint64_t timestamp=0;int64_t error=0;
10 assert(home_audio_read(capture,bytes,480,100,&frames,&timestamp,&error)==0);
11 assert(frames>0 && frames<=480 && timestamp>0 && error==0);
12 home_audio_close(capture);
13 capture=NULL;cfg.channels=3;
14 assert(home_audio_open(&cfg,"null",&capture)==-1 && !capture);
15 return 0;
16}