comparison src/twjit.c @ 6:668b84c52094

twrtp_jibuf_create(): take quantum_ms & clock_khz arguments
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 05 Jul 2024 21:34:55 +0000
parents 1bb26347e253
children 95f6c8ce33b0
comparison
equal deleted inserted replaced
5:1bb26347e253 6:668b84c52094
23 } 23 }
24 24
25 /* create and destroy functions */ 25 /* create and destroy functions */
26 26
27 struct twrtp_jibuf_inst * 27 struct twrtp_jibuf_inst *
28 twrtp_jibuf_create(void *ctx, uint16_t quantum_ms, uint32_t quantum_ts_inc, 28 twrtp_jibuf_create(void *ctx, uint16_t quantum_ms, uint16_t clock_khz,
29 struct twrtp_jibuf_config *config) 29 struct twrtp_jibuf_config *config)
30 { 30 {
31 struct twrtp_jibuf_inst *twjit; 31 struct twrtp_jibuf_inst *twjit;
32 32
33 twjit = talloc_zero(ctx, struct twrtp_jibuf_inst); 33 twjit = talloc_zero(ctx, struct twrtp_jibuf_inst);
34 if (!twjit) 34 if (!twjit)
35 return NULL; 35 return NULL;
36 36
37 twjit->ext_config = config; 37 twjit->ext_config = config;
38 twjit->ts_quantum = quantum_ts_inc; 38 twjit->ts_quantum = (uint32_t)quantum_ms * clock_khz;
39 twjit->quanta_per_sec = 1000 / quantum_ms; 39 twjit->quanta_per_sec = 1000 / quantum_ms;
40 twjit->state = TWJIT_STATE_EMPTY; 40 twjit->state = TWJIT_STATE_EMPTY;
41 INIT_LLIST_HEAD(&twjit->sb[0].queue); 41 INIT_LLIST_HEAD(&twjit->sb[0].queue);
42 INIT_LLIST_HEAD(&twjit->sb[1].queue); 42 INIT_LLIST_HEAD(&twjit->sb[1].queue);
43 43