summaryrefslogtreecommitdiff
path: root/toxav
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-08-26 20:34:26 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-09-03 20:03:47 +0000
commit6872c14e1a02445d945623ee6e85230c5d7ecbce (patch)
tree30d90b93445976e56b96946b6e87b764eddd48a8 /toxav
parentd296490a742b226fc17a71cf96ab73fc16719b20 (diff)
Avoid use of global mutable state in mono_time on win32.
This uses a trick to get read-write access to `this` from a `const` member function, similar to C++ `mutable`, but uglier.
Diffstat (limited to 'toxav')
-rw-r--r--toxav/audio.c4
-rw-r--r--toxav/audio.h6
-rw-r--r--toxav/rtp.h2
-rw-r--r--toxav/video.c4
-rw-r--r--toxav/video.h4
5 files changed, 10 insertions, 10 deletions
diff --git a/toxav/audio.c b/toxav/audio.c
index 5da41570..de007424 100644
--- a/toxav/audio.c
+++ b/toxav/audio.c
@@ -44,7 +44,7 @@ static bool reconfigure_audio_decoder(ACSession *ac, int32_t sampling_rate, int8
44 44
45 45
46 46
47ACSession *ac_new(const Mono_Time *mono_time, const Logger *log, ToxAV *av, uint32_t friend_number, 47ACSession *ac_new(Mono_Time *mono_time, const Logger *log, ToxAV *av, uint32_t friend_number,
48 toxav_audio_receive_frame_cb *cb, void *cb_data) 48 toxav_audio_receive_frame_cb *cb, void *cb_data)
49{ 49{
50 ACSession *ac = (ACSession *)calloc(sizeof(ACSession), 1); 50 ACSession *ac = (ACSession *)calloc(sizeof(ACSession), 1);
@@ -216,7 +216,7 @@ void ac_iterate(ACSession *ac)
216 pthread_mutex_unlock(ac->queue_mutex); 216 pthread_mutex_unlock(ac->queue_mutex);
217} 217}
218 218
219int ac_queue_message(const Mono_Time *mono_time, void *acp, struct RTPMessage *msg) 219int ac_queue_message(Mono_Time *mono_time, void *acp, struct RTPMessage *msg)
220{ 220{
221 if (!acp || !msg) { 221 if (!acp || !msg) {
222 return -1; 222 return -1;
diff --git a/toxav/audio.h b/toxav/audio.h
index 1a33a2ae..a323a08e 100644
--- a/toxav/audio.h
+++ b/toxav/audio.h
@@ -50,7 +50,7 @@
50#define AUDIO_MAX_BUFFER_SIZE_BYTES (AUDIO_MAX_BUFFER_SIZE_PCM16 * 2) 50#define AUDIO_MAX_BUFFER_SIZE_BYTES (AUDIO_MAX_BUFFER_SIZE_PCM16 * 2)
51 51
52typedef struct ACSession_s { 52typedef struct ACSession_s {
53 const Mono_Time *mono_time; 53 Mono_Time *mono_time;
54 const Logger *log; 54 const Logger *log;
55 55
56 /* encoding */ 56 /* encoding */
@@ -78,11 +78,11 @@ typedef struct ACSession_s {
78 void *acb_user_data; 78 void *acb_user_data;
79} ACSession; 79} ACSession;
80 80
81ACSession *ac_new(const Mono_Time *mono_time, const Logger *log, ToxAV *av, uint32_t friend_number, 81ACSession *ac_new(Mono_Time *mono_time, const Logger *log, ToxAV *av, uint32_t friend_number,
82 toxav_audio_receive_frame_cb *cb, void *cb_data); 82 toxav_audio_receive_frame_cb *cb, void *cb_data);
83void ac_kill(ACSession *ac); 83void ac_kill(ACSession *ac);
84void ac_iterate(ACSession *ac); 84void ac_iterate(ACSession *ac);
85int ac_queue_message(const Mono_Time *mono_time, void *acp, struct RTPMessage *msg); 85int ac_queue_message(Mono_Time *mono_time, void *acp, struct RTPMessage *msg);
86int ac_reconfigure_encoder(ACSession *ac, int32_t bit_rate, int32_t sampling_rate, uint8_t channels); 86int ac_reconfigure_encoder(ACSession *ac, int32_t bit_rate, int32_t sampling_rate, uint8_t channels);
87 87
88#endif /* AUDIO_H */ 88#endif /* AUDIO_H */
diff --git a/toxav/rtp.h b/toxav/rtp.h
index 42997594..e068f6ac 100644
--- a/toxav/rtp.h
+++ b/toxav/rtp.h
@@ -159,7 +159,7 @@ struct RTPWorkBufferList {
159 159
160#define DISMISS_FIRST_LOST_VIDEO_PACKET_COUNT 10 160#define DISMISS_FIRST_LOST_VIDEO_PACKET_COUNT 10
161 161
162typedef int rtp_m_cb(const Mono_Time *mono_time, void *cs, struct RTPMessage *msg); 162typedef int rtp_m_cb(Mono_Time *mono_time, void *cs, struct RTPMessage *msg);
163 163
164/** 164/**
165 * RTP control session. 165 * RTP control session.
diff --git a/toxav/video.c b/toxav/video.c
index 3f4d96e1..ab47ae97 100644
--- a/toxav/video.c
+++ b/toxav/video.c
@@ -159,7 +159,7 @@ static void vc_init_encoder_cfg(const Logger *log, vpx_codec_enc_cfg_t *cfg, int
159#endif 159#endif
160} 160}
161 161
162VCSession *vc_new(const Mono_Time *mono_time, const Logger *log, ToxAV *av, uint32_t friend_number, 162VCSession *vc_new(Mono_Time *mono_time, const Logger *log, ToxAV *av, uint32_t friend_number,
163 toxav_video_receive_frame_cb *cb, void *cb_data) 163 toxav_video_receive_frame_cb *cb, void *cb_data)
164{ 164{
165 VCSession *vc = (VCSession *)calloc(sizeof(VCSession), 1); 165 VCSession *vc = (VCSession *)calloc(sizeof(VCSession), 1);
@@ -357,7 +357,7 @@ void vc_iterate(VCSession *vc)
357 } 357 }
358} 358}
359 359
360int vc_queue_message(const Mono_Time *mono_time, void *vcp, struct RTPMessage *msg) 360int vc_queue_message(Mono_Time *mono_time, void *vcp, struct RTPMessage *msg)
361{ 361{
362 /* This function is called with complete messages 362 /* This function is called with complete messages
363 * they have already been assembled. 363 * they have already been assembled.
diff --git a/toxav/video.h b/toxav/video.h
index 2eee1c05..16f4658b 100644
--- a/toxav/video.h
+++ b/toxav/video.h
@@ -60,11 +60,11 @@ typedef struct VCSession_s {
60 pthread_mutex_t queue_mutex[1]; 60 pthread_mutex_t queue_mutex[1];
61} VCSession; 61} VCSession;
62 62
63VCSession *vc_new(const Mono_Time *mono_time, const Logger *log, ToxAV *av, uint32_t friend_number, 63VCSession *vc_new(Mono_Time *mono_time, const Logger *log, ToxAV *av, uint32_t friend_number,
64 toxav_video_receive_frame_cb *cb, void *cb_data); 64 toxav_video_receive_frame_cb *cb, void *cb_data);
65void vc_kill(VCSession *vc); 65void vc_kill(VCSession *vc);
66void vc_iterate(VCSession *vc); 66void vc_iterate(VCSession *vc);
67int vc_queue_message(const Mono_Time *mono_time, void *vcp, struct RTPMessage *msg); 67int vc_queue_message(Mono_Time *mono_time, void *vcp, struct RTPMessage *msg);
68int vc_reconfigure_encoder(VCSession *vc, uint32_t bit_rate, uint16_t width, uint16_t height, int16_t kf_max_dist); 68int vc_reconfigure_encoder(VCSession *vc, uint32_t bit_rate, uint16_t width, uint16_t height, int16_t kf_max_dist);
69 69
70#endif /* VIDEO_H */ 70#endif /* VIDEO_H */