diff options
author | Eniz Vukovic <eniz_vukovic@hotmail.com> | 2015-10-10 23:54:23 +0200 |
---|---|---|
committer | Eniz Vukovic <eniz_vukovic@hotmail.com> | 2015-10-10 23:54:23 +0200 |
commit | d6fdf16520b6f242935ca95eeb739ec9a8eaa14c (patch) | |
tree | 069f3355835aa0497fe494c36554ea24d0b222f1 /toxav/audio.h | |
parent | bf5e9b89d2a67c293aae503c03e193307ea7990b (diff) |
New Adaptive BR algorithm, cleanups and fixes
Diffstat (limited to 'toxav/audio.h')
-rw-r--r-- | toxav/audio.h | 65 |
1 files changed, 20 insertions, 45 deletions
diff --git a/toxav/audio.h b/toxav/audio.h index 9ef10ae4..b1db7448 100644 --- a/toxav/audio.h +++ b/toxav/audio.h | |||
@@ -29,61 +29,36 @@ | |||
29 | 29 | ||
30 | #include "../toxcore/util.h" | 30 | #include "../toxcore/util.h" |
31 | 31 | ||
32 | struct RTPMessage_s; | 32 | struct RTPMessage; |
33 | 33 | ||
34 | /* | ||
35 | * Base Audio Codec session type. | ||
36 | */ | ||
37 | typedef struct ACSession_s { | 34 | typedef struct ACSession_s { |
38 | /* encoding */ | 35 | /* encoding */ |
39 | OpusEncoder *encoder; | 36 | OpusEncoder *encoder; |
40 | int32_t last_encoding_sampling_rate; | 37 | int32_t le_sample_rate; /* Last encoder sample rate */ |
41 | int32_t last_encoding_channel_count; | 38 | int32_t le_channel_count; /* Last encoder channel count */ |
42 | int32_t last_encoding_bit_rate; | 39 | int32_t le_bit_rate; /* Last encoder bit rate */ |
43 | 40 | ||
44 | /* Testing encoder for dynamic bit rate streaming */ | ||
45 | OpusEncoder *test_encoder; | ||
46 | int32_t last_test_encoding_sampling_rate; | ||
47 | int32_t last_test_encoding_channel_count; | ||
48 | int32_t last_test_encoding_bit_rate; | ||
49 | |||
50 | /* decoding */ | 41 | /* decoding */ |
51 | OpusDecoder *decoder; | 42 | OpusDecoder *decoder; |
52 | int32_t last_packet_channel_count; | 43 | int32_t lp_channel_count; /* Last packet channel count */ |
53 | int32_t last_packet_sampling_rate; | 44 | int32_t lp_sampling_rate; /* Last packet sample rate */ |
54 | int32_t last_packet_frame_duration; | 45 | int32_t lp_frame_duration; /* Last packet frame duration */ |
55 | int32_t last_decoding_sampling_rate; | 46 | int32_t ld_sample_rate; /* Last decoder sample rate */ |
56 | int32_t last_decoding_channel_count; | 47 | int32_t ld_channel_count; /* Last decoder channel count */ |
57 | uint64_t last_decoder_reconfiguration; | 48 | uint64_t ldrts; /* Last decoder reconfiguration time stamp */ |
58 | void *j_buf; | 49 | void *j_buf; |
59 | 50 | ||
60 | pthread_mutex_t queue_mutex[1]; | 51 | pthread_mutex_t queue_mutex[1]; |
61 | 52 | ||
62 | ToxAV* av; | 53 | ToxAV *av; |
63 | uint32_t friend_number; | 54 | uint32_t friend_number; |
64 | PAIR(toxav_audio_receive_frame_cb *, void *) acb; /* Audio frame receive callback */ | 55 | PAIR(toxav_audio_receive_frame_cb *, void *) acb; /* Audio frame receive callback */ |
65 | } ACSession; | 56 | } ACSession; |
66 | 57 | ||
67 | /* | 58 | ACSession *ac_new(ToxAV *av, uint32_t friend_number, toxav_audio_receive_frame_cb *cb, void *cb_data); |
68 | * Create new Audio Codec session. | 59 | void ac_kill(ACSession *ac); |
69 | */ | 60 | void ac_iterate(ACSession *ac); |
70 | ACSession* ac_new(ToxAV* av, uint32_t friend_number, toxav_audio_receive_frame_cb *cb, void *cb_data); | 61 | int ac_queue_message(void *acp, struct RTPMessage *msg); |
71 | /* | 62 | int ac_reconfigure_encoder(ACSession *ac, int32_t bit_rate, int32_t sampling_rate, uint8_t channels); |
72 | * Kill the Audio Codec session. | ||
73 | */ | ||
74 | void ac_kill(ACSession* ac); | ||
75 | /* | ||
76 | * Do periodic work. Work is consisted out of decoding only. | ||
77 | */ | ||
78 | void ac_do(ACSession* ac); | ||
79 | /* | ||
80 | * Queue new rtp message. | ||
81 | */ | ||
82 | int ac_queue_message(void *acp, struct RTPMessage_s *msg); | ||
83 | /* | ||
84 | * Set new values to the encoders. | ||
85 | */ | ||
86 | int ac_reconfigure_encoder(ACSession* ac, int32_t bit_rate, int32_t sampling_rate, uint8_t channels); | ||
87 | int ac_reconfigure_test_encoder(ACSession* ac, int32_t bit_rate, int32_t sampling_rate, uint8_t channels); | ||
88 | 63 | ||
89 | #endif /* AUDIO_H */ \ No newline at end of file | 64 | #endif /* AUDIO_H */ |