diff options
author | iphydf <iphydf@users.noreply.github.com> | 2016-09-19 21:49:04 +0100 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2016-09-19 21:53:40 +0100 |
commit | 51d18236c8effffb14ffe6c5e3f738c1ceb1ae25 (patch) | |
tree | e18ff983aba08aee690cc001f7cf4928a94f80d3 /toxav/audio.c | |
parent | 67ac9138ab773728f0a8d1093aaa80d40a9f9efc (diff) |
Revert "Make ToxAV stateless"
This reverts commit 21f8db12c45bd56293262cd4abfb73cd9abec821.
It is currently broken. Incoming call callbacks are not invoked, and
instead the client goes offline immediately.
Diffstat (limited to 'toxav/audio.c')
-rw-r--r-- | toxav/audio.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/toxav/audio.c b/toxav/audio.c index 3fb0985e..59d1554e 100644 --- a/toxav/audio.c +++ b/toxav/audio.c | |||
@@ -43,7 +43,7 @@ bool reconfigure_audio_decoder(ACSession *ac, int32_t sampling_rate, int8_t chan | |||
43 | 43 | ||
44 | 44 | ||
45 | 45 | ||
46 | ACSession *ac_new(Logger *log, ToxAV *av, uint32_t friend_number, toxav_audio_receive_frame_cb *cb) | 46 | ACSession *ac_new(Logger *log, ToxAV *av, uint32_t friend_number, toxav_audio_receive_frame_cb *cb, void *cb_data) |
47 | { | 47 | { |
48 | ACSession *ac = calloc(sizeof(ACSession), 1); | 48 | ACSession *ac = calloc(sizeof(ACSession), 1); |
49 | 49 | ||
@@ -97,7 +97,8 @@ ACSession *ac_new(Logger *log, ToxAV *av, uint32_t friend_number, toxav_audio_re | |||
97 | 97 | ||
98 | ac->av = av; | 98 | ac->av = av; |
99 | ac->friend_number = friend_number; | 99 | ac->friend_number = friend_number; |
100 | ac->on_audio_frame = cb; | 100 | ac->acb.first = cb; |
101 | ac->acb.second = cb_data; | ||
101 | 102 | ||
102 | return ac; | 103 | return ac; |
103 | 104 | ||
@@ -124,7 +125,7 @@ void ac_kill(ACSession *ac) | |||
124 | LOGGER_DEBUG(ac->log, "Terminated audio handler: %p", ac); | 125 | LOGGER_DEBUG(ac->log, "Terminated audio handler: %p", ac); |
125 | free(ac); | 126 | free(ac); |
126 | } | 127 | } |
127 | void ac_iterate(ACSession *ac, void *userdata) | 128 | void ac_iterate(ACSession *ac) |
128 | { | 129 | { |
129 | if (!ac) { | 130 | if (!ac) { |
130 | return; | 131 | return; |
@@ -185,11 +186,11 @@ void ac_iterate(ACSession *ac, void *userdata) | |||
185 | 186 | ||
186 | if (rc < 0) { | 187 | if (rc < 0) { |
187 | LOGGER_WARNING(ac->log, "Decoding error: %s", opus_strerror(rc)); | 188 | LOGGER_WARNING(ac->log, "Decoding error: %s", opus_strerror(rc)); |
188 | } else if (ac->on_audio_frame) { | 189 | } else if (ac->acb.first) { |
189 | ac->lp_frame_duration = (rc * 1000) / ac->lp_sampling_rate; | 190 | ac->lp_frame_duration = (rc * 1000) / ac->lp_sampling_rate; |
190 | 191 | ||
191 | ac->on_audio_frame(ac->av, ac->friend_number, tmp, rc, ac->lp_channel_count, | 192 | ac->acb.first(ac->av, ac->friend_number, tmp, rc, ac->lp_channel_count, |
192 | ac->lp_sampling_rate, userdata); | 193 | ac->lp_sampling_rate, ac->acb.second); |
193 | } | 194 | } |
194 | 195 | ||
195 | return; | 196 | return; |