mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-26 14:53:26 +01:00
Began conversion of audio code to new ToxAV API
This commit is contained in:
parent
6e90072fb8
commit
3241551cfb
BIN
altacc.tox
Normal file
BIN
altacc.tox
Normal file
Binary file not shown.
518
gdb.txt
Normal file
518
gdb.txt
Normal file
@ -0,0 +1,518 @@
|
|||||||
|
Reading symbols from /usr/local/bin/toxic...done.
|
||||||
|
Starting program: /usr/local/bin/toxic
|
||||||
|
[Thread debugging using libthread_db enabled]
|
||||||
|
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
|
||||||
|
[New Thread 0x7fffe8b60700 (LWP 14024)]
|
||||||
|
[New Thread 0x7fffe7f61700 (LWP 14035)]
|
||||||
|
[New Thread 0x7fffe7760700 (LWP 14036)]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 14037)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 14037) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 14038)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 14038) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 14039)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 14039) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 14040)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 14040) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 14041)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 14041) exited]
|
||||||
|
[New Thread 0x7fffe4d03700 (LWP 14042)]
|
||||||
|
[Thread 0x7fffe4d03700 (LWP 14042) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 14043)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 14043) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 14044)]
|
||||||
|
[New Thread 0x7fffe4c82700 (LWP 14045)]
|
||||||
|
[New Thread 0x7fffdfcef700 (LWP 14046)]
|
||||||
|
[New Thread 0x7fffdf4ee700 (LWP 14076)]
|
||||||
|
[Thread 0x7fffdf4ee700 (LWP 14076) exited]
|
||||||
|
[New Thread 0x7fffdf4ee700 (LWP 14077)]
|
||||||
|
[New Thread 0x7fffdacec700 (LWP 14078)]
|
||||||
|
[New Thread 0x7fffda4eb700 (LWP 14079)]
|
||||||
|
|
||||||
|
Program received signal SIGABRT, Aborted.
|
||||||
|
[Switching to Thread 0x7fffe7f61700 (LWP 14035)]
|
||||||
|
0x00007ffff573d0d5 in raise () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#0 0x00007ffff573d0d5 in raise () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#1 0x00007ffff574083b in abort () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#2 0x00007ffff5735d9e in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#3 0x00007ffff5735e42 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#4 0x00007ffff7020c99 in rtp_new (payload_type=193, m=0x74de60, friend_num=0, cs=0x0,
|
||||||
|
mcb=0x7ffff7024790 <vc_queue_message>) at ../toxav/rtp.c:84
|
||||||
|
#5 0x00007ffff7025c67 in call_prepare_transmission (call=0x8e0080) at ../toxav/toxav.c:1283
|
||||||
|
#6 0x00007ffff7025e54 in toxav_answer (av=0x86e130, friend_number=0, audio_bit_rate=48,
|
||||||
|
video_bit_rate=0, error=0x7fffe7f5ef58) at ../toxav/toxav.c:410
|
||||||
|
#7 0x000000000042bc11 in cmd_answer (window=0x7fffe002ab60, self=0x63ff90, m=0x74de60, argc=0,
|
||||||
|
argv=0x7fffe7f5f000) at /home/cnhenry/Workspace/toxic/src/audio_call.c:645
|
||||||
|
#8 0x000000000040d4b3 in do_command (w=0x7fffe002ab60, self=0x63ff90, m=0x74de60, num_args=1,
|
||||||
|
commands=0x63ab40, args=0x7fffe7f5f000) at /home/cnhenry/Workspace/toxic/src/execute.c:151
|
||||||
|
#9 0x000000000040d592 in execute (w=0x7fffe002ab60, self=0x63ff90, m=0x74de60,
|
||||||
|
input=0x7fffe7f60620 "/answer", mode=1) at /home/cnhenry/Workspace/toxic/src/execute.c:176
|
||||||
|
#10 0x0000000000409827 in chat_onKey (self=0x63ff90, m=0x74de60, key=10, ltr=false)
|
||||||
|
at /home/cnhenry/Workspace/toxic/src/chat.c:889
|
||||||
|
#11 0x0000000000427e67 in draw_active_window (m=0x74de60)
|
||||||
|
at /home/cnhenry/Workspace/toxic/src/windows.c:544
|
||||||
|
#12 0x0000000000424a05 in thread_winref (data=0x74de60)
|
||||||
|
at /home/cnhenry/Workspace/toxic/src/toxic.c:800
|
||||||
|
#13 0x00007ffff612ce9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
|
||||||
|
#14 0x00007ffff57fa38d in clone () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#15 0x0000000000000000 in ?? ()Reading symbols from /usr/local/bin/toxic...done.
|
||||||
|
Starting program: /usr/local/bin/toxic
|
||||||
|
[Thread debugging using libthread_db enabled]
|
||||||
|
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
|
||||||
|
[New Thread 0x7fffe8b60700 (LWP 16834)]
|
||||||
|
[New Thread 0x7fffe7f61700 (LWP 16845)]
|
||||||
|
[New Thread 0x7fffe7760700 (LWP 16846)]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 16847)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 16847) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 16848)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 16848) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 16849)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 16849) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 16850)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 16850) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 16851)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 16851) exited]
|
||||||
|
[New Thread 0x7fffe4d03700 (LWP 16852)]
|
||||||
|
[Thread 0x7fffe4d03700 (LWP 16852) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 16853)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 16853) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 16854)]
|
||||||
|
[New Thread 0x7fffe4c82700 (LWP 16855)]
|
||||||
|
[New Thread 0x7fffdfcef700 (LWP 16856)]
|
||||||
|
[New Thread 0x7fffdf4ee700 (LWP 16894)]
|
||||||
|
[Thread 0x7fffdf4ee700 (LWP 16894) exited]
|
||||||
|
[New Thread 0x7fffdf4ee700 (LWP 16895)]
|
||||||
|
[New Thread 0x7fffdacec700 (LWP 16896)]
|
||||||
|
[New Thread 0x7fffda4eb700 (LWP 16897)]
|
||||||
|
[Thread 0x7fffdacec700 (LWP 16896) exited]
|
||||||
|
[Thread 0x7fffdf4ee700 (LWP 16895) exited]
|
||||||
|
[New Thread 0x7fffdf4ee700 (LWP 16949)]
|
||||||
|
[New Thread 0x7fffdacec700 (LWP 16950)]
|
||||||
|
|
||||||
|
Program received signal SIGABRT, Aborted.
|
||||||
|
[Switching to Thread 0x7fffe7f61700 (LWP 16845)]
|
||||||
|
0x00007ffff573d0d5 in raise () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
Breakpoint 1 at 0x7ffff7024c34: file ../toxav/video.c, line 61.
|
||||||
|
Breakpoint 2 at 0x7ffff7024c53: file ../toxav/video.c, line 63.
|
||||||
|
Breakpoint 3 at 0x7ffff7024c6d: file ../toxav/video.c, line 65.
|
||||||
|
Breakpoint 4 at 0x7ffff7024c98: file ../toxav/video.c, line 71.
|
||||||
|
Breakpoint 5 at 0x7ffff7024ca9: file ../toxav/video.c, line 76.
|
||||||
|
Breakpoint 6 at 0x7ffff7024cbb: file ../toxav/video.c, line 81.
|
||||||
|
#0 0x00007ffff573d0d5 in raise () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#1 0x00007ffff574083b in abort () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#2 0x00007ffff5735d9e in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#3 0x00007ffff5735e42 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#4 0x00007ffff7020c99 in rtp_new (payload_type=193, m=0x74de60, friend_num=0, cs=0x0,
|
||||||
|
mcb=0x7ffff7024790 <vc_queue_message>) at ../toxav/rtp.c:84
|
||||||
|
#5 0x00007ffff7025c67 in call_prepare_transmission (call=0x8c9db0) at ../toxav/toxav.c:1283
|
||||||
|
#6 0x00007ffff7025e54 in toxav_answer (av=0x86dce0, friend_number=0, audio_bit_rate=48,
|
||||||
|
video_bit_rate=0, error=0x7fffe7f5ef58) at ../toxav/toxav.c:410
|
||||||
|
#7 0x000000000042bc11 in cmd_answer (window=0x7fffe002ab60, self=0x63ff90, m=0x74de60, argc=0,
|
||||||
|
argv=0x7fffe7f5f000) at /home/cnhenry/Workspace/toxic/src/audio_call.c:645
|
||||||
|
#8 0x000000000040d4b3 in do_command (w=0x7fffe002ab60, self=0x63ff90, m=0x74de60, num_args=1,
|
||||||
|
commands=0x63ab40, args=0x7fffe7f5f000) at /home/cnhenry/Workspace/toxic/src/execute.c:151
|
||||||
|
#9 0x000000000040d592 in execute (w=0x7fffe002ab60, self=0x63ff90, m=0x74de60,
|
||||||
|
input=0x7fffe7f60620 "/answer", mode=1) at /home/cnhenry/Workspace/toxic/src/execute.c:176
|
||||||
|
#10 0x0000000000409827 in chat_onKey (self=0x63ff90, m=0x74de60, key=10, ltr=false)
|
||||||
|
at /home/cnhenry/Workspace/toxic/src/chat.c:889
|
||||||
|
#11 0x0000000000427e67 in draw_active_window (m=0x74de60)
|
||||||
|
at /home/cnhenry/Workspace/toxic/src/windows.c:544
|
||||||
|
#12 0x0000000000424a05 in thread_winref (data=0x74de60)
|
||||||
|
at /home/cnhenry/Workspace/toxic/src/toxic.c:800
|
||||||
|
#13 0x00007ffff612ce9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
|
||||||
|
#14 0x00007ffff57fa38d in clone () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#15 0x0000000000000000 in ?? ()
|
||||||
|
#5 0x00007ffff7025c67 in call_prepare_transmission (call=0x8c9db0) at ../toxav/toxav.c:1283
|
||||||
|
1283 call->video.first = rtp_new(rtp_TypeVideo, av->m, call->friend_number, call->video.second, vc_queue_message);
|
||||||
|
|
||||||
|
Breakpoint 1, vc_new (av=0x86dce0, friend_number=0, cb=0x42b14c <receive_video_frame_cb>,
|
||||||
|
cb_data=0x71c260, mvfpsz=500) at ../toxav/video.c:62
|
||||||
|
62 if ( !(vc->split_video_frame = calloc(VIDEOFRAME_PIECE_SIZE + VIDEOFRAME_HEADER_SIZE, 1)) )
|
||||||
|
The program being debugged stopped while in a function called from GDB.
|
||||||
|
Evaluation of the expression containing the function
|
||||||
|
(vc_new) will be abandoned.
|
||||||
|
When the function is done executing, GDB will silently stop.
|
||||||
|
Continuing.
|
||||||
|
|
||||||
|
Breakpoint 2, vc_new (av=0x86dce0, friend_number=0, cb=0x42b14c <receive_video_frame_cb>,
|
||||||
|
cb_data=0x71c260, mvfpsz=500) at ../toxav/video.c:64
|
||||||
|
64 if ( !(vc->vbuf_raw = rb_new(VIDEO_DECODE_BUFFER_SIZE)) )
|
||||||
|
Continuing.
|
||||||
|
|
||||||
|
Breakpoint 3, vc_new (av=0x86dce0, friend_number=0, cb=0x42b14c <receive_video_frame_cb>,
|
||||||
|
cb_data=0x71c260, mvfpsz=500) at ../toxav/video.c:67
|
||||||
|
67 int rc = vpx_codec_dec_init_ver(vc->decoder, VIDEO_CODEC_DECODER_INTERFACE,
|
||||||
|
Continuing.
|
||||||
|
Continuing.
|
||||||
|
[Thread 0x7fffdacec700 (LWP 16950) exited]
|
||||||
|
[Thread 0x7fffdf4ee700 (LWP 16949) exited]
|
||||||
|
[Thread 0x7fffe4c82700 (LWP 16855) exited]
|
||||||
|
[Thread 0x7fffe7f61700 (LWP 16845) exited]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 16854) exited]
|
||||||
|
[Thread 0x7fffe7760700 (LWP 16846) exited]
|
||||||
|
[Thread 0x7fffdfcef700 (LWP 16856) exited]
|
||||||
|
[Thread 0x7fffe8b60700 (LWP 16834) exited]
|
||||||
|
[Thread 0x7ffff7fae940 (LWP 16831) exited]
|
||||||
|
|
||||||
|
Program terminated with signal SIGABRT, Aborted.
|
||||||
|
The program no longer exists.
|
||||||
|
Quit
|
||||||
|
Reading symbols from /usr/local/bin/toxic...done.
|
||||||
|
Starting program: /usr/local/bin/toxic
|
||||||
|
[Thread debugging using libthread_db enabled]
|
||||||
|
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
|
||||||
|
[New Thread 0x7fffe8b60700 (LWP 27196)]
|
||||||
|
[New Thread 0x7fffe7f61700 (LWP 27207)]
|
||||||
|
[New Thread 0x7fffe7760700 (LWP 27208)]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 27209)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 27209) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 27210)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 27210) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 27211)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 27211) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 27212)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 27212) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 27213)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 27213) exited]
|
||||||
|
[New Thread 0x7fffe4d03700 (LWP 27214)]
|
||||||
|
[Thread 0x7fffe4d03700 (LWP 27214) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 27215)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 27215) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 27216)]
|
||||||
|
[New Thread 0x7fffe4c82700 (LWP 27217)]
|
||||||
|
[New Thread 0x7fffdfcef700 (LWP 27218)]
|
||||||
|
[New Thread 0x7fffdf4ee700 (LWP 27255)]
|
||||||
|
[Thread 0x7fffdf4ee700 (LWP 27255) exited]
|
||||||
|
[New Thread 0x7fffdf4ee700 (LWP 27256)]
|
||||||
|
[New Thread 0x7fffdacec700 (LWP 27258)]
|
||||||
|
[New Thread 0x7fffda4eb700 (LWP 27261)]
|
||||||
|
[Thread 0x7fffdacec700 (LWP 27258) exited]
|
||||||
|
[Thread 0x7fffdf4ee700 (LWP 27256) exited]
|
||||||
|
[New Thread 0x7fffdf4ee700 (LWP 27279)]
|
||||||
|
[New Thread 0x7fffdacec700 (LWP 27280)]
|
||||||
|
|
||||||
|
Program received signal SIGABRT, Aborted.
|
||||||
|
[Switching to Thread 0x7fffe7f61700 (LWP 27207)]
|
||||||
|
0x00007ffff573d0d5 in raise () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#0 0x00007ffff573d0d5 in raise () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#1 0x00007ffff574083b in abort () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#2 0x00007ffff5735d9e in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#3 0x00007ffff5735e42 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#4 0x00007ffff7024dc4 in vc_new (av=0x86e690, friend_number=0,
|
||||||
|
cb=0x42b14c <receive_video_frame_cb>, cb_data=0x71c260, mvfpsz=500) at ../toxav/video.c:71
|
||||||
|
#5 0x00007ffff7025ce5 in call_prepare_transmission (call=0x90a5a0) at ../toxav/toxav.c:1282
|
||||||
|
#6 0x00007ffff7025ef4 in toxav_answer (av=0x86e690, friend_number=0, audio_bit_rate=48,
|
||||||
|
video_bit_rate=0, error=0x7fffe7f5ef58) at ../toxav/toxav.c:410
|
||||||
|
#7 0x000000000042bc11 in cmd_answer (window=0x7fffe002ab60, self=0x63ff90, m=0x74de60, argc=0,
|
||||||
|
argv=0x7fffe7f5f000) at /home/cnhenry/Workspace/toxic/src/audio_call.c:645
|
||||||
|
#8 0x000000000040d4b3 in do_command (w=0x7fffe002ab60, self=0x63ff90, m=0x74de60, num_args=1,
|
||||||
|
commands=0x63ab40, args=0x7fffe7f5f000) at /home/cnhenry/Workspace/toxic/src/execute.c:151
|
||||||
|
#9 0x000000000040d592 in execute (w=0x7fffe002ab60, self=0x63ff90, m=0x74de60,
|
||||||
|
input=0x7fffe7f60620 "/answer", mode=1) at /home/cnhenry/Workspace/toxic/src/execute.c:176
|
||||||
|
#10 0x0000000000409827 in chat_onKey (self=0x63ff90, m=0x74de60, key=10, ltr=false)
|
||||||
|
at /home/cnhenry/Workspace/toxic/src/chat.c:889
|
||||||
|
#11 0x0000000000427e67 in draw_active_window (m=0x74de60)
|
||||||
|
at /home/cnhenry/Workspace/toxic/src/windows.c:544
|
||||||
|
#12 0x0000000000424a05 in thread_winref (data=0x74de60)
|
||||||
|
at /home/cnhenry/Workspace/toxic/src/toxic.c:800
|
||||||
|
#13 0x00007ffff612ce9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
|
||||||
|
#14 0x00007ffff57fa38d in clone () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#15 0x0000000000000000 in ?? ()
|
||||||
|
#5 0x00007ffff7025ce5 in call_prepare_transmission (call=0x90a5a0) at ../toxav/toxav.c:1282
|
||||||
|
1282 call->video.second = vc_new(av, call->friend_number, av->vcb.first, av->vcb.second, call->msi_call->peer_vfpsz);
|
||||||
|
Breakpoint 1 at 0x7ffff7024d2c: file ../toxav/video.c, line 61.
|
||||||
|
Breakpoint 2 at 0x7ffff7024de3: file ../toxav/video.c, line 63.
|
||||||
|
Breakpoint 3 at 0x7ffff7024dc4: file ../toxav/video.c, line 65.
|
||||||
|
Breakpoint 4 at 0x7ffff7024da5: file ../toxav/video.c, line 71.
|
||||||
|
Breakpoint 5 at 0x7ffff7024d86: file ../toxav/video.c, line 76.
|
||||||
|
Breakpoint 6 at 0x7ffff7024d5d: file ../toxav/video.c, line 81.
|
||||||
|
#5 0x00007ffff7025ce5 in call_prepare_transmission (call=0x90a5a0) at ../toxav/toxav.c:1282
|
||||||
|
1282 call->video.second = vc_new(av, call->friend_number, av->vcb.first, av->vcb.second, call->msi_call->peer_vfpsz);
|
||||||
|
|
||||||
|
Breakpoint 4, vc_new (av=0x86e690, friend_number=0, cb=0x42b14c <receive_video_frame_cb>,
|
||||||
|
cb_data=0x71c260, mvfpsz=500) at ../toxav/video.c:71
|
||||||
|
71 assert(0);//goto BASE_CLEANUP;
|
||||||
|
The program being debugged stopped while in a function called from GDB.
|
||||||
|
Evaluation of the expression containing the function
|
||||||
|
(vc_new) will be abandoned.
|
||||||
|
When the function is done executing, GDB will silently stop.
|
||||||
|
Continuing.
|
||||||
|
|
||||||
|
Program received signal SIGABRT, Aborted.
|
||||||
|
0x00007ffff573d0d5 in raise () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
Continuing.
|
||||||
|
[Thread 0x7fffdacec700 (LWP 27280) exited]
|
||||||
|
[Thread 0x7fffda4eb700 (LWP 27261) exited]
|
||||||
|
[Thread 0x7fffdfcef700 (LWP 27218) exited]
|
||||||
|
[Thread 0x7fffdf4ee700 (LWP 27279) exited]
|
||||||
|
[Thread 0x7fffe4c82700 (LWP 27217) exited]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 27216) exited]
|
||||||
|
[Thread 0x7fffe7760700 (LWP 27208) exited]
|
||||||
|
[Thread 0x7fffe8b60700 (LWP 27196) exited]
|
||||||
|
[Thread 0x7ffff7fae940 (LWP 27193) exited]
|
||||||
|
|
||||||
|
Program terminated with signal SIGABRT, Aborted.
|
||||||
|
The program no longer exists.
|
||||||
|
Reading symbols from /usr/local/bin/toxic...done.
|
||||||
|
Starting program: /usr/local/bin/toxic
|
||||||
|
[Thread debugging using libthread_db enabled]
|
||||||
|
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
|
||||||
|
[New Thread 0x7fffe8b60700 (LWP 27641)]
|
||||||
|
[New Thread 0x7fffe7f61700 (LWP 27652)]
|
||||||
|
[New Thread 0x7fffe7760700 (LWP 27653)]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 27654)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 27654) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 27655)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 27655) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 27656)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 27656) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 27657)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 27657) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 27658)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 27658) exited]
|
||||||
|
[New Thread 0x7fffe4d03700 (LWP 27659)]
|
||||||
|
[Thread 0x7fffe4d03700 (LWP 27659) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 27660)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 27660) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 27661)]
|
||||||
|
[New Thread 0x7fffe4c82700 (LWP 27662)]
|
||||||
|
[New Thread 0x7fffdfcef700 (LWP 27663)]
|
||||||
|
[New Thread 0x7fffdf4ee700 (LWP 27679)]
|
||||||
|
[Thread 0x7fffdf4ee700 (LWP 27679) exited]
|
||||||
|
[New Thread 0x7fffdf4ee700 (LWP 27680)]
|
||||||
|
[New Thread 0x7fffdacec700 (LWP 27681)]
|
||||||
|
[New Thread 0x7fffda4eb700 (LWP 27682)]
|
||||||
|
[Thread 0x7fffdacec700 (LWP 27681) exited]
|
||||||
|
[Thread 0x7fffdf4ee700 (LWP 27680) exited]
|
||||||
|
[New Thread 0x7fffdf4ee700 (LWP 27703)]
|
||||||
|
[New Thread 0x7fffdacec700 (LWP 27704)]
|
||||||
|
|
||||||
|
Program received signal SIGABRT, Aborted.
|
||||||
|
[Switching to Thread 0x7fffe7f61700 (LWP 27652)]
|
||||||
|
0x00007ffff573d0d5 in raise () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#0 0x00007ffff573d0d5 in raise () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#1 0x00007ffff574083b in abort () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#2 0x00007ffff5735d9e in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#3 0x00007ffff5735e42 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#4 0x00007ffff7024dc4 in vc_new (av=0x86d900, friend_number=0,
|
||||||
|
cb=0x42b14c <receive_video_frame_cb>, cb_data=0x71c260, mvfpsz=500) at ../toxav/video.c:71
|
||||||
|
#5 0x00007ffff7025ce5 in call_prepare_transmission (call=0x8f4190) at ../toxav/toxav.c:1282
|
||||||
|
#6 0x00007ffff7025ef4 in toxav_answer (av=0x86d900, friend_number=0, audio_bit_rate=48,
|
||||||
|
video_bit_rate=0, error=0x7fffe7f5ef58) at ../toxav/toxav.c:410
|
||||||
|
#7 0x000000000042bc11 in cmd_answer (window=0x7fffe002ab60, self=0x63ff90, m=0x74de60, argc=0,
|
||||||
|
argv=0x7fffe7f5f000) at /home/cnhenry/Workspace/toxic/src/audio_call.c:645
|
||||||
|
#8 0x000000000040d4b3 in do_command (w=0x7fffe002ab60, self=0x63ff90, m=0x74de60, num_args=1,
|
||||||
|
commands=0x63ab40, args=0x7fffe7f5f000) at /home/cnhenry/Workspace/toxic/src/execute.c:151
|
||||||
|
#9 0x000000000040d592 in execute (w=0x7fffe002ab60, self=0x63ff90, m=0x74de60,
|
||||||
|
input=0x7fffe7f60620 "/answer", mode=1) at /home/cnhenry/Workspace/toxic/src/execute.c:176
|
||||||
|
#10 0x0000000000409827 in chat_onKey (self=0x63ff90, m=0x74de60, key=10, ltr=false)
|
||||||
|
at /home/cnhenry/Workspace/toxic/src/chat.c:889
|
||||||
|
#11 0x0000000000427e67 in draw_active_window (m=0x74de60)
|
||||||
|
at /home/cnhenry/Workspace/toxic/src/windows.c:544
|
||||||
|
#12 0x0000000000424a05 in thread_winref (data=0x74de60)
|
||||||
|
at /home/cnhenry/Workspace/toxic/src/toxic.c:800
|
||||||
|
#13 0x00007ffff612ce9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
|
||||||
|
#14 0x00007ffff57fa38d in clone () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#15 0x0000000000000000 in ?? ()
|
||||||
|
#5 0x00007ffff7025ce5 in call_prepare_transmission (call=0x8f4190) at ../toxav/toxav.c:1282
|
||||||
|
1282 call->video.second = vc_new(av, call->friend_number, av->vcb.first, av->vcb.second, call->msi_call->peer_vfpsz);
|
||||||
|
|
||||||
|
Program received signal SIGABRT, Aborted.
|
||||||
|
0x00007ffff573d0d5 in raise () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
The program being debugged was signaled while in a function called from GDB.
|
||||||
|
GDB remains in the frame where the signal was received.
|
||||||
|
To change this behavior use "set unwindonsignal on".
|
||||||
|
Evaluation of the expression containing the function
|
||||||
|
(vc_new) will be abandoned.
|
||||||
|
When the function is done executing, GDB will silently stop.
|
||||||
|
Continuing.
|
||||||
|
[Thread 0x7fffe7760700 (LWP 27653) exited]
|
||||||
|
[Thread 0x7fffdacec700 (LWP 27704) exited]
|
||||||
|
[Thread 0x7fffdf4ee700 (LWP 27703) exited]
|
||||||
|
[Thread 0x7fffda4eb700 (LWP 27682) exited]
|
||||||
|
[Thread 0x7fffdfcef700 (LWP 27663) exited]
|
||||||
|
[Thread 0x7fffe4c82700 (LWP 27662) exited]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 27661) exited]
|
||||||
|
[Thread 0x7fffe7f61700 (LWP 27652) exited]
|
||||||
|
[Thread 0x7fffe8b60700 (LWP 27641) exited]
|
||||||
|
|
||||||
|
Program terminated with signal SIGABRT, Aborted.
|
||||||
|
The program no longer exists.Reading symbols from /usr/local/bin/toxic...done.
|
||||||
|
Starting program: /usr/local/bin/toxic
|
||||||
|
[Thread debugging using libthread_db enabled]
|
||||||
|
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
|
||||||
|
[New Thread 0x7fffe8b60700 (LWP 32161)]
|
||||||
|
[New Thread 0x7fffe7f61700 (LWP 32172)]
|
||||||
|
[New Thread 0x7fffe7760700 (LWP 32173)]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 32174)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 32174) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 32175)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 32175) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 32176)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 32176) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 32177)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 32177) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 32178)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 32178) exited]
|
||||||
|
[New Thread 0x7fffe4d03700 (LWP 32179)]
|
||||||
|
[Thread 0x7fffe4d03700 (LWP 32179) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 32180)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 32180) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 32181)]
|
||||||
|
[New Thread 0x7fffe4c82700 (LWP 32182)]
|
||||||
|
[New Thread 0x7fffdfcef700 (LWP 32183)]
|
||||||
|
[New Thread 0x7fffdf4ee700 (LWP 32661)]
|
||||||
|
[Thread 0x7fffdf4ee700 (LWP 32661) exited]
|
||||||
|
[New Thread 0x7fffdf4ee700 (LWP 32663)]
|
||||||
|
[New Thread 0x7fffdacec700 (LWP 32664)]
|
||||||
|
[New Thread 0x7fffda4eb700 (LWP 32666)]
|
||||||
|
[Thread 0x7fffdacec700 (LWP 32664) exited]
|
||||||
|
[Thread 0x7fffdf4ee700 (LWP 32663) exited]
|
||||||
|
[New Thread 0x7fffdf4ee700 (LWP 32677)]
|
||||||
|
[New Thread 0x7fffdacec700 (LWP 32679)]
|
||||||
|
|
||||||
|
Program received signal SIGABRT, Aborted.
|
||||||
|
[Switching to Thread 0x7fffe7f61700 (LWP 32172)]
|
||||||
|
0x00007ffff573d0d5 in raise () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#0 0x00007ffff573d0d5 in raise () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#1 0x00007ffff574083b in abort () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#2 0x00007ffff5735d9e in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#3 0x00007ffff5735e42 in __assert_fail ()
|
||||||
|
from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#4 0x00007ffff7024dc4 in vc_new (av=0x7e1fc0, friend_number=0,
|
||||||
|
cb=0x42b14c <receive_video_frame_cb>, cb_data=0x71c260, mvfpsz=500)
|
||||||
|
at ../toxav/video.c:71
|
||||||
|
#5 0x00007ffff7025ce5 in call_prepare_transmission (call=0x84e2c0)
|
||||||
|
at ../toxav/toxav.c:1282
|
||||||
|
#6 0x00007ffff7025ef4 in toxav_answer (av=0x7e1fc0, friend_number=0,
|
||||||
|
audio_bit_rate=48, video_bit_rate=0, error=0x7fffe7f5ef58)
|
||||||
|
at ../toxav/toxav.c:410
|
||||||
|
#7 0x000000000042bc11 in cmd_answer (window=0x7fffe000dc90, self=0x63ff90,
|
||||||
|
m=0x74de60, argc=0, argv=0x7fffe7f5f000)
|
||||||
|
at /home/cnhenry/Workspace/toxic/src/audio_call.c:645
|
||||||
|
#8 0x000000000040d4b3 in do_command (w=0x7fffe000dc90, self=0x63ff90,
|
||||||
|
m=0x74de60, num_args=1, commands=0x63ab40, args=0x7fffe7f5f000)
|
||||||
|
at /home/cnhenry/Workspace/toxic/src/execute.c:151
|
||||||
|
#9 0x000000000040d592 in execute (w=0x7fffe000dc90, self=0x63ff90,
|
||||||
|
m=0x74de60, input=0x7fffe7f60620 "/answer", mode=1)
|
||||||
|
at /home/cnhenry/Workspace/toxic/src/execute.c:176
|
||||||
|
#10 0x0000000000409827 in chat_onKey (self=0x63ff90, m=0x74de60, key=10,
|
||||||
|
ltr=false) at /home/cnhenry/Workspace/toxic/src/chat.c:889
|
||||||
|
#11 0x0000000000427e67 in draw_active_window (m=0x74de60)
|
||||||
|
at /home/cnhenry/Workspace/toxic/src/windows.c:544
|
||||||
|
#12 0x0000000000424a05 in thread_winref (data=0x74de60)
|
||||||
|
at /home/cnhenry/Workspace/toxic/src/toxic.c:800
|
||||||
|
#13 0x00007ffff612ce9a in start_thread ()
|
||||||
|
from /lib/x86_64-linux-gnu/libpthread.so.0
|
||||||
|
#14 0x00007ffff57fa38d in clone () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
#15 0x0000000000000000 in ?? ()
|
||||||
|
#5 0x00007ffff7025ce5 in call_prepare_transmission (call=0x84e2c0)
|
||||||
|
at ../toxav/toxav.c:1282
|
||||||
|
1282 call->video.second = vc_new(av, call->friend_number, av->vcb.first, av->vcb.second, call->msi_call->peer_vfpsz);
|
||||||
|
#5 0x00007ffff7025ce5 in call_prepare_transmission (call=0x84e2c0)
|
||||||
|
at ../toxav/toxav.c:1282
|
||||||
|
1282 call->video.second = vc_new(av, call->friend_number, av->vcb.first, av->vcb.second, call->msi_call->peer_vfpsz);
|
||||||
|
The history is empty.
|
||||||
|
Invalid character ';' in expression.
|
||||||
|
Invalid character ';' in expression.
|
||||||
|
|
||||||
|
Program received signal SIGABRT, Aborted.
|
||||||
|
0x00007ffff573d0d5 in raise () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
The program being debugged was signaled while in a function called from GDB.
|
||||||
|
GDB remains in the frame where the signal was received.
|
||||||
|
To change this behavior use "set unwindonsignal on".
|
||||||
|
Evaluation of the expression containing the function
|
||||||
|
(vc_new) will be abandoned.
|
||||||
|
When the function is done executing, GDB will silently stop.
|
||||||
|
Continuing.
|
||||||
|
[Thread 0x7fffda4eb700 (LWP 32666) exited]
|
||||||
|
[Thread 0x7fffdacec700 (LWP 32679) exited]
|
||||||
|
[Thread 0x7fffe4c82700 (LWP 32182) exited]
|
||||||
|
[Thread 0x7fffdf4ee700 (LWP 32677) exited]
|
||||||
|
[Thread 0x7fffdfcef700 (LWP 32183) exited]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 32181) exited]
|
||||||
|
[Thread 0x7fffe7f61700 (LWP 32172) exited]
|
||||||
|
[Thread 0x7fffe8b60700 (LWP 32161) exited]
|
||||||
|
[Thread 0x7ffff7fae940 (LWP 32158) exited]
|
||||||
|
|
||||||
|
Program terminated with signal SIGABRT, Aborted.
|
||||||
|
The program no longer exists.
|
||||||
|
No stack.
|
||||||
|
No registers.
|
||||||
|
Reading symbols from /usr/local/bin/toxic...done.
|
||||||
|
Starting program: /usr/local/bin/toxic
|
||||||
|
[Thread debugging using libthread_db enabled]
|
||||||
|
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
|
||||||
|
[New Thread 0x7fffe8b60700 (LWP 4878)]
|
||||||
|
[New Thread 0x7fffe7f61700 (LWP 5333)]
|
||||||
|
[New Thread 0x7fffe7760700 (LWP 5334)]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 5335)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 5335) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 5336)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 5336) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 5337)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 5337) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 5338)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 5338) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 5339)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 5339) exited]
|
||||||
|
[New Thread 0x7fffe4d03700 (LWP 5340)]
|
||||||
|
[Thread 0x7fffe4d03700 (LWP 5340) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 5341)]
|
||||||
|
[Thread 0x7fffe5dad700 (LWP 5341) exited]
|
||||||
|
[New Thread 0x7fffe5dad700 (LWP 5342)]
|
||||||
|
[New Thread 0x7fffe4c82700 (LWP 5343)]
|
||||||
|
[New Thread 0x7fffdfcef700 (LWP 5344)]
|
||||||
|
[New Thread 0x7fffdf4ee700 (LWP 5738)]
|
||||||
|
[Thread 0x7fffdf4ee700 (LWP 5738) exited]
|
||||||
|
[New Thread 0x7fffdf4ee700 (LWP 5739)]
|
||||||
|
[New Thread 0x7fffdacec700 (LWP 5740)]
|
||||||
|
[New Thread 0x7fffda4eb700 (LWP 5741)]
|
||||||
|
[Thread 0x7fffdacec700 (LWP 5740) exited]
|
||||||
|
[Thread 0x7fffdf4ee700 (LWP 5739) exited]
|
||||||
|
|
||||||
|
Program received signal SIGINT, Interrupt.
|
||||||
|
0x00007ffff57c60ad in nanosleep () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
A debugging session is active.
|
||||||
|
|
||||||
|
Inferior 1 [process 4875] will be killed.
|
||||||
|
|
||||||
|
Quit anyway? (y or n) Reading symbols from /usr/local/bin/toxic...done.
|
||||||
|
Starting program: /usr/local/bin/toxic
|
||||||
|
[Thread debugging using libthread_db enabled]
|
||||||
|
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
|
||||||
|
[New Thread 0x7fffe8b60700 (LWP 20862)]
|
||||||
|
[New Thread 0x7fffe7eb2700 (LWP 20876)]
|
||||||
|
[New Thread 0x7fffe76b1700 (LWP 20877)]
|
||||||
|
[New Thread 0x7fffe5cdb700 (LWP 20878)]
|
||||||
|
[Thread 0x7fffe5cdb700 (LWP 20878) exited]
|
||||||
|
[New Thread 0x7fffe5cdb700 (LWP 20879)]
|
||||||
|
[Thread 0x7fffe5cdb700 (LWP 20879) exited]
|
||||||
|
[New Thread 0x7fffe5cdb700 (LWP 20880)]
|
||||||
|
[Thread 0x7fffe5cdb700 (LWP 20880) exited]
|
||||||
|
[New Thread 0x7fffe5cdb700 (LWP 20881)]
|
||||||
|
[Thread 0x7fffe5cdb700 (LWP 20881) exited]
|
||||||
|
[New Thread 0x7fffe5cdb700 (LWP 20882)]
|
||||||
|
[Thread 0x7fffe5cdb700 (LWP 20882) exited]
|
||||||
|
[New Thread 0x7fffe4c31700 (LWP 20883)]
|
||||||
|
[Thread 0x7fffe4c31700 (LWP 20883) exited]
|
||||||
|
[New Thread 0x7fffe5cdb700 (LWP 20884)]
|
||||||
|
[Thread 0x7fffe5cdb700 (LWP 20884) exited]
|
||||||
|
[New Thread 0x7fffe5cdb700 (LWP 20885)]
|
||||||
|
[New Thread 0x7fffe4bb0700 (LWP 20886)]
|
||||||
|
[New Thread 0x7fffdfcef700 (LWP 20887)]
|
||||||
|
[New Thread 0x7fffdf4ee700 (LWP 21416)]
|
||||||
|
[Thread 0x7fffdf4ee700 (LWP 21416) exited]
|
||||||
|
[New Thread 0x7fffdf4ee700 (LWP 21417)]
|
||||||
|
[New Thread 0x7fffdacec700 (LWP 21418)]
|
||||||
|
[New Thread 0x7fffda4eb700 (LWP 21419)]
|
||||||
|
[Thread 0x7fffdacec700 (LWP 21418) exited]
|
||||||
|
[Thread 0x7fffdf4ee700 (LWP 21417) exited]
|
||||||
|
|
||||||
|
Program received signal SIGINT, Interrupt.
|
||||||
|
0x00007ffff57c60ad in nanosleep () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
Quit
|
||||||
|
A debugging session is active.
|
||||||
|
|
||||||
|
Inferior 1 [process 20859] will be killed.
|
||||||
|
|
||||||
|
Quit anyway? (y or n)
|
2768
libtoxcore.log
Normal file
2768
libtoxcore.log
Normal file
File diff suppressed because it is too large
Load Diff
570
src/audio_call.c
570
src/audio_call.c
@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
#define MAX_CALLS 10
|
#define MAX_CALLS 10
|
||||||
|
|
||||||
#define frame_size (av_DefaultSettings.audio_sample_rate * av_DefaultSettings.audio_frame_duration / 1000)
|
#define frame_size (CallContrl.audio_bit_rate * CallContrl.audio_frame_duration / 1000)
|
||||||
|
|
||||||
static int set_call(Call* call, bool start)
|
static int set_call(Call* call, bool start)
|
||||||
{
|
{
|
||||||
@ -75,148 +75,211 @@ static int set_call(Call* call, bool start)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ASettings {
|
typedef struct CallControl {
|
||||||
AudioError errors;
|
AudioError errors;
|
||||||
|
|
||||||
ToxAv *av;
|
ToxAV *av;
|
||||||
|
ToxWindow *window;
|
||||||
ToxAvCSettings cs;
|
|
||||||
|
|
||||||
Call calls[MAX_CALLS];
|
Call calls[MAX_CALLS];
|
||||||
} ASettins;
|
bool pending_call;
|
||||||
|
uint32_t call_state;
|
||||||
|
|
||||||
void callback_recv_invite ( void* av, int32_t call_index, void *arg );
|
bool audio_enabled;
|
||||||
void callback_recv_ringing ( void* av, int32_t call_index, void *arg );
|
bool video_enabled;
|
||||||
void callback_recv_starting ( void* av, int32_t call_index, void *arg );
|
|
||||||
void callback_recv_ending ( void* av, int32_t call_index, void *arg );
|
|
||||||
void callback_call_started ( void* av, int32_t call_index, void *arg );
|
|
||||||
void callback_call_canceled ( void* av, int32_t call_index, void *arg );
|
|
||||||
void callback_call_rejected ( void* av, int32_t call_index, void *arg );
|
|
||||||
void callback_call_ended ( void* av, int32_t call_index, void *arg );
|
|
||||||
void callback_requ_timeout ( void* av, int32_t call_index, void *arg );
|
|
||||||
void callback_peer_timeout ( void* av, int32_t call_index, void *arg );
|
|
||||||
void callback_media_change ( void* av, int32_t call_index, void *arg );
|
|
||||||
|
|
||||||
void write_device_callback( void* agent, int32_t call_index, const int16_t* PCM, uint16_t size, void* arg );
|
uint32_t audio_bit_rate;
|
||||||
|
uint32_t video_bit_rate;
|
||||||
|
|
||||||
|
uint32_t audio_sample_rate;
|
||||||
|
|
||||||
|
int32_t audio_frame_duration;
|
||||||
|
int32_t video_frame_duration;
|
||||||
|
|
||||||
|
uint8_t audio_channels;
|
||||||
|
|
||||||
|
} CallControl;
|
||||||
|
|
||||||
|
CallControl CallContrl;
|
||||||
|
|
||||||
|
void call_cb(ToxAV *av, uint32_t friend_number, bool audio_enabled, bool video_enabled, void *user_data);
|
||||||
|
void callstate_cb(ToxAV *av, uint32_t friend_number, uint32_t state, void *user_data);
|
||||||
|
void receive_audio_frame_cb(ToxAV *av, uint32_t friend_number, int16_t const *pcm, size_t sample_count, uint8_t channels, uint32_t sampling_rate, void *user_data);
|
||||||
|
void audio_bit_rate_status_cb(ToxAV *av, uint32_t friend_number, bool stable, uint32_t bit_rate, void *user_data);
|
||||||
|
void receive_video_frame_cb(ToxAV *av, uint32_t friend_number,
|
||||||
|
uint16_t width, uint16_t height,
|
||||||
|
uint8_t const *y, uint8_t const *u, uint8_t const *v, uint8_t const *a,
|
||||||
|
int32_t ystride, int32_t ustride, int32_t vstride, int32_t astride,
|
||||||
|
void *user_data);
|
||||||
|
void video_bit_rate_status_cb(ToxAV *av, uint32_t friend_number,
|
||||||
|
bool stable, uint32_t bit_rate, void *user_data);
|
||||||
|
|
||||||
|
void callback_recv_invite ( void* av, uint32_t friend_number, void *arg );
|
||||||
|
void callback_recv_ringing ( void* av, uint32_t friend_number, void *arg );
|
||||||
|
void callback_recv_starting ( void* av, uint32_t friend_number, void *arg );
|
||||||
|
void callback_recv_ending ( void* av, uint32_t friend_number, void *arg );
|
||||||
|
void callback_call_started ( void* av, uint32_t friend_number, void *arg );
|
||||||
|
void callback_call_canceled ( void* av, uint32_t friend_number, void *arg );
|
||||||
|
void callback_call_rejected ( void* av, uint32_t friend_number, void *arg );
|
||||||
|
void callback_call_ended ( void* av, uint32_t friend_number, void *arg );
|
||||||
|
void callback_requ_timeout ( void* av, uint32_t friend_number, void *arg );
|
||||||
|
void callback_peer_timeout ( void* av, uint32_t friend_number, void *arg );
|
||||||
|
void callback_media_change ( void* av, uint32_t friend_number, void *arg );
|
||||||
|
|
||||||
|
void write_device_callback( void* agent, int32_t friend_number, const int16_t* PCM, uint16_t size, void* arg );
|
||||||
|
|
||||||
static void print_err (ToxWindow *self, const char *error_str)
|
static void print_err (ToxWindow *self, const char *error_str)
|
||||||
{
|
{
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "%s", error_str);
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "%s", error_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
ToxAv *init_audio(ToxWindow *self, Tox *tox)
|
ToxAV *init_audio(ToxWindow *self, Tox *tox)
|
||||||
{
|
{
|
||||||
ASettins.cs = av_DefaultSettings;
|
TOXAV_ERR_NEW error;
|
||||||
ASettins.cs.max_video_height = ASettins.cs.max_video_width = 0;
|
|
||||||
|
|
||||||
ASettins.errors = ae_None;
|
CallContrl.window = self;
|
||||||
|
|
||||||
memset(ASettins.calls, 0, sizeof(ASettins.calls));
|
CallContrl.audio_enabled = true;
|
||||||
|
CallContrl.audio_bit_rate = 48;
|
||||||
|
CallContrl.audio_sample_rate = 48000;
|
||||||
|
CallContrl.audio_frame_duration = 10;
|
||||||
|
CallContrl.audio_channels = 1;
|
||||||
|
|
||||||
|
CallContrl.errors = ae_None;
|
||||||
|
|
||||||
|
memset(CallContrl.calls, 0, sizeof(CallContrl.calls));
|
||||||
|
|
||||||
/* Streaming stuff from core */
|
/* Streaming stuff from core */
|
||||||
|
|
||||||
ASettins.av = toxav_new(tox, MAX_CALLS);
|
CallContrl.av = toxav_new(tox, &error);
|
||||||
|
|
||||||
if ( !ASettins.av ) {
|
if( error == TOXAV_ERR_NEW_OK) {
|
||||||
ASettins.errors |= ae_StartingCoreAudio;
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "TOXAV_ERR_NEW_OK");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tox == toxav_get_tox(CallContrl.av)) {
|
||||||
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Tox instance matches");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !CallContrl.av ) {
|
||||||
|
CallContrl.errors |= ae_StartingCoreAudio;
|
||||||
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to init ToxAV");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( init_devices(ASettins.av) == de_InternalError ) {
|
if ( init_devices(CallContrl.av) == de_InternalError ) {
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to init devices");
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to init devices");
|
||||||
toxav_kill(ASettins.av);
|
toxav_kill(CallContrl.av);
|
||||||
return ASettins.av = NULL;
|
return CallContrl.av = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
toxav_register_callstate_callback(ASettins.av, callback_call_started, av_OnStart, self);
|
|
||||||
toxav_register_callstate_callback(ASettins.av, callback_call_canceled, av_OnCancel, self);
|
|
||||||
toxav_register_callstate_callback(ASettins.av, callback_call_rejected, av_OnReject, self);
|
|
||||||
toxav_register_callstate_callback(ASettins.av, callback_call_ended, av_OnEnd, self);
|
|
||||||
toxav_register_callstate_callback(ASettins.av, callback_recv_invite, av_OnInvite, self);
|
|
||||||
|
|
||||||
toxav_register_callstate_callback(ASettins.av, callback_recv_ringing, av_OnRinging, self);
|
/*toxav_register_callstate_callback(CallContrl.av, callback_call_started, av_OnStart, self);
|
||||||
toxav_register_callstate_callback(ASettins.av, callback_recv_starting, av_OnStart, self);
|
toxav_register_callstate_callback(CallContrl.av, callback_call_canceled, av_OnCancel, self);
|
||||||
toxav_register_callstate_callback(ASettins.av, callback_recv_ending, av_OnEnd, self);
|
toxav_register_callstate_callback(CallContrl.av, callback_call_rejected, av_OnReject, self);
|
||||||
|
toxav_register_callstate_callback(CallContrl.av, callback_call_ended, av_OnEnd, self);
|
||||||
|
toxav_register_callstate_callback(CallContrl.av, callback_recv_invite, av_OnInvite, self);
|
||||||
|
|
||||||
toxav_register_callstate_callback(ASettins.av, callback_requ_timeout, av_OnRequestTimeout, self);
|
toxav_register_callstate_callback(CallContrl.av, callback_recv_ringing, av_OnRinging, self);
|
||||||
toxav_register_callstate_callback(ASettins.av, callback_peer_timeout, av_OnPeerTimeout, self);
|
toxav_register_callstate_callback(CallContrl.av, callback_recv_starting, av_OnStart, self);
|
||||||
//toxav_register_callstate_callback(ASettins.av, callback_media_change, av_OnMediaChange, self);
|
toxav_register_callstate_callback(CallContrl.av, callback_recv_ending, av_OnEnd, self);
|
||||||
|
|
||||||
toxav_register_audio_callback(ASettins.av, write_device_callback, NULL);
|
toxav_register_callstate_callback(CallContrl.av, callback_requ_timeout, av_OnRequestTimeout, self);
|
||||||
|
toxav_register_callstate_callback(CallContrl.av, callback_peer_timeout, av_OnPeerTimeout, self);
|
||||||
|
//toxav_register_callstate_callback(CallContrl.av, callback_media_change, av_OnMediaChange, self);
|
||||||
|
|
||||||
return ASettins.av;
|
toxav_register_audio_callback(CallContrl.av, write_device_callback, NULL);
|
||||||
|
*/
|
||||||
|
|
||||||
|
toxav_callback_call(CallContrl.av, call_cb, &CallContrl);
|
||||||
|
toxav_callback_call_state(CallContrl.av, callstate_cb, &CallContrl);
|
||||||
|
toxav_callback_audio_receive_frame(CallContrl.av, receive_audio_frame_cb, &CallContrl);
|
||||||
|
toxav_callback_audio_bit_rate_status(CallContrl.av, audio_bit_rate_status_cb, &CallContrl);
|
||||||
|
toxav_callback_video_receive_frame(CallContrl.av, receive_video_frame_cb, &CallContrl);
|
||||||
|
toxav_callback_video_bit_rate_status(CallContrl.av, video_bit_rate_status_cb, &CallContrl);
|
||||||
|
|
||||||
|
return CallContrl.av;
|
||||||
}
|
}
|
||||||
|
|
||||||
void terminate_audio()
|
void terminate_audio()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < MAX_CALLS; ++i)
|
for (i = 0; i < MAX_CALLS; ++i)
|
||||||
stop_transmission(&ASettins.calls[i], i);
|
stop_transmission(&CallContrl.calls[i], i);
|
||||||
|
|
||||||
if ( ASettins.av )
|
if ( CallContrl.av )
|
||||||
toxav_kill(ASettins.av);
|
toxav_kill(CallContrl.av);
|
||||||
|
|
||||||
terminate_devices();
|
terminate_devices();
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_device_callback (const int16_t* captured, uint32_t size, void* data)
|
void read_device_callback (const int16_t* captured, uint32_t size, void* data)
|
||||||
{
|
{
|
||||||
int32_t call_index = *((int32_t*)data); /* TODO: Or pass an array of call_idx's */
|
int32_t friend_number = *((int32_t*)data); /* TODO: Or pass an array of call_idx's */
|
||||||
|
|
||||||
uint8_t encoded_payload[RTP_PAYLOAD_SIZE];
|
//uint8_t encoded_payload[RTP_PAYLOAD_SIZE];
|
||||||
int32_t payload_size = toxav_prepare_audio_frame(ASettins.av, call_index, encoded_payload, RTP_PAYLOAD_SIZE, captured, size);
|
//int32_t payload_size = toxav_prepare_audio_frame(CallContrl.av, friend_number, encoded_payload, RTP_PAYLOAD_SIZE, captured, size);
|
||||||
if ( payload_size <= 0 || toxav_send_audio(ASettins.av, call_index, encoded_payload, payload_size) < 0 ) {
|
//if ( payload_size <= 0 || toxav_send_audio(CallContrl.av, friend_number, encoded_payload, payload_size) < 0 ) {
|
||||||
/*fprintf(stderr, "Could not encode audio packet\n");*/
|
// /*fprintf(stderr, "Could not encode audio packet\n");*/
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
void write_device_callback(void *agent, int32_t call_index, const int16_t* PCM, uint16_t size, void* arg)
|
void write_device_callback(void *agent, int32_t friend_number, const int16_t* PCM, uint16_t size, void* arg)
|
||||||
{
|
{
|
||||||
(void)arg;
|
(void)arg;
|
||||||
(void)agent;
|
(void)agent;
|
||||||
|
|
||||||
if (call_index >= 0 && ASettins.calls[call_index].ttas) {
|
|
||||||
ToxAvCSettings csettings = ASettins.cs;
|
if (friend_number >= 0 && CallContrl.calls[friend_number].ttas) {
|
||||||
toxav_get_peer_csettings(ASettins.av, call_index, 0, &csettings);
|
//ToxAvCSettings csettings = CallContrl.cs;
|
||||||
write_out(ASettins.calls[call_index].out_idx, PCM, size, csettings.audio_channels);
|
//toxav_get_peer_csettings(CallContrl.av, friend_number, 0, &csettings);
|
||||||
|
write_out(CallContrl.calls[friend_number].out_idx, PCM, size, CallContrl.audio_channels);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int start_transmission(ToxWindow *self, Call *call)
|
int start_transmission(ToxWindow *self, Call *call)
|
||||||
{
|
{
|
||||||
if ( !self || !ASettins.av || self->call_idx == -1 ) {
|
if ( !self || !CallContrl.av || self->num == -1 ) {
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Could not prepare transmission");
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Could not prepare transmission");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't provide support for video */
|
/* Don't provide support for video */
|
||||||
if ( 0 != toxav_prepare_transmission(ASettins.av, self->call_idx, 0) ) {
|
/*
|
||||||
|
if ( 0 != toxav_prepare_transmission(CallContrl.av, self->num, 0) ) {
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Could not prepare transmission");
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Could not prepare transmission");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !toxav_capability_supported(ASettins.av, self->call_idx, av_AudioDecoding) ||
|
if ( !toxav_capability_supported(CallContrl.av, self->num, av_AudioDecoding) ||
|
||||||
!toxav_capability_supported(ASettins.av, self->call_idx, av_AudioEncoding) )
|
!toxav_capability_supported(CallContrl.av, self->num, av_AudioEncoding) )
|
||||||
return -1;
|
return -1;
|
||||||
|
*/
|
||||||
|
|
||||||
if (set_call(call, true) == -1)
|
if (set_call(call, true) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ToxAvCSettings csettings;
|
//ToxAvCSettings csettings;
|
||||||
toxav_get_peer_csettings(ASettins.av, self->call_idx, 0, &csettings);
|
//toxav_get_peer_csettings(CallContrl.av, self->call_idx, 0, &csettings);
|
||||||
|
|
||||||
if ( open_primary_device(input, &call->in_idx,
|
DeviceError test = open_primary_device(input, &call->in_idx, CallContrl.audio_bit_rate, CallContrl.audio_frame_duration, CallContrl.audio_channels);
|
||||||
csettings.audio_sample_rate, csettings.audio_frame_duration, csettings.audio_channels) != de_None )
|
|
||||||
|
if ( test == de_FailedStart)
|
||||||
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed Start");
|
||||||
|
|
||||||
|
if ( test == de_InternalError )
|
||||||
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Internal Error");
|
||||||
|
|
||||||
|
if ( test != de_None )
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to open input device!");
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to open input device!");
|
||||||
|
|
||||||
if ( register_device_callback(self->call_idx, call->in_idx,
|
if ( register_device_callback(self->num, call->in_idx,
|
||||||
read_device_callback, &self->call_idx, true) != de_None)
|
read_device_callback, &self->num, true) != de_None)
|
||||||
/* Set VAD as true for all; TODO: Make it more dynamic */
|
/* Set VAD as true for all; TODO: Make it more dynamic */
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to register input handler!");
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to register input handler!");
|
||||||
|
|
||||||
if ( open_primary_device(output, &call->out_idx,
|
if ( open_primary_device(output, &call->out_idx,
|
||||||
csettings.audio_sample_rate, csettings.audio_frame_duration, csettings.audio_channels) != de_None ) {
|
CallContrl.audio_bit_rate, CallContrl.audio_frame_duration, CallContrl.audio_channels) != de_None ) {
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to open output device!");
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to open output device!");
|
||||||
call->has_output = 0;
|
call->has_output = 0;
|
||||||
}
|
}
|
||||||
@ -224,10 +287,13 @@ int start_transmission(ToxWindow *self, Call *call)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int stop_transmission(Call *call, int32_t call_index)
|
int stop_transmission(Call *call, int32_t friend_number)
|
||||||
{
|
{
|
||||||
if ( call->ttas ) {
|
if ( call->ttas ) {
|
||||||
toxav_kill_transmission(ASettins.av, call_index);
|
TOXAV_ERR_CALL_CONTROL error;
|
||||||
|
bool call_running = toxav_call_control(CallContrl.av, friend_number, TOXAV_CALL_CONTROL_CANCEL, &error);
|
||||||
|
//toxav_kill_transmission(CallContrl.av, friend_number);
|
||||||
|
if(error == TOXAV_ERR_CALL_CONTROL_OK) {
|
||||||
call->ttas = false;
|
call->ttas = false;
|
||||||
|
|
||||||
if ( call->in_idx != -1 )
|
if ( call->in_idx != -1 )
|
||||||
@ -240,6 +306,10 @@ int stop_transmission(Call *call, int32_t call_index)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
@ -256,81 +326,247 @@ int stop_transmission(Call *call, int32_t call_index)
|
|||||||
* Callbacks
|
* Callbacks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CB_BODY(call_idx, Arg, onFunc) do { ToxWindow* windows = (Arg); int i;\
|
void call_cb(ToxAV *av, uint32_t friend_number, bool audio_enabled, bool video_enabled, void *user_data)
|
||||||
for (i = 0; i < MAX_WINDOWS_NUM; ++i) if (windows[i].onFunc != NULL) windows[i].onFunc(&windows[i], ASettins.av, call_idx); } while (0)
|
{
|
||||||
|
TOXAV_ERR_ANSWER error;
|
||||||
|
CallControl* cc = user_data;
|
||||||
|
ToxWindow* window = cc->window;
|
||||||
|
cc->pending_call = true;
|
||||||
|
|
||||||
void callback_recv_invite ( void* av, int32_t call_index, void* arg )
|
line_info_add(window, NULL, NULL, NULL, SYS_MSG, 0, 0, "Incoming call callback! Friend number: %d", friend_number);
|
||||||
{
|
|
||||||
CB_BODY(call_index, arg, onInvite);
|
callback_recv_invite(av, friend_number, user_data);
|
||||||
|
//toxav_answer(CallContrl.av, friend_number, 48, 0, &error);
|
||||||
}
|
}
|
||||||
void callback_recv_ringing ( void* av, int32_t call_index, void* arg )
|
|
||||||
|
void callstate_cb(ToxAV *av, uint32_t friend_number, uint32_t state, void *user_data)
|
||||||
{
|
{
|
||||||
CB_BODY(call_index, arg, onRinging);
|
CallControl* cc = user_data;
|
||||||
|
ToxWindow* window = cc->window;
|
||||||
|
cc->call_state = state;
|
||||||
|
|
||||||
|
line_info_add(window, NULL, NULL, NULL, SYS_MSG, 0, 0, "Callstate callback! Friend number: %d", friend_number);
|
||||||
|
|
||||||
|
switch(state) {
|
||||||
|
case TOXAV_CALL_STATE_ERROR:
|
||||||
|
line_info_add(window, NULL, NULL, NULL, SYS_MSG, 0, 0, "TOXAV_CALL_STATE_ERROR");
|
||||||
|
break;
|
||||||
|
case TOXAV_CALL_STATE_FINISHED:
|
||||||
|
line_info_add(window, NULL, NULL, NULL, SYS_MSG, 0, 0, "TOXAV_CALL_STATE_FINISHED");
|
||||||
|
|
||||||
|
if(CallContrl.pending_call) {
|
||||||
|
line_info_add(window, NULL, NULL, NULL, SYS_MSG, 0, 0, "Pending Call Rejected");
|
||||||
|
CallContrl.pending_call = false;
|
||||||
|
callback_call_rejected(CallContrl.av, window->num, &CallContrl);
|
||||||
|
} else {
|
||||||
|
line_info_add(window, NULL, NULL, NULL, SYS_MSG, 0, 0, "Existing Call Cancelled");
|
||||||
|
callback_call_canceled(CallContrl.av, window->num, &CallContrl);
|
||||||
}
|
}
|
||||||
void callback_recv_starting ( void* av, int32_t call_index, void* arg )
|
break;
|
||||||
|
case TOXAV_CALL_STATE_SENDING_A:
|
||||||
|
line_info_add(window, NULL, NULL, NULL, SYS_MSG, 0, 0, "TOXAV_CALL_STATE_SENDING_A");
|
||||||
|
break;
|
||||||
|
case TOXAV_CALL_STATE_SENDING_V:
|
||||||
|
line_info_add(window, NULL, NULL, NULL, SYS_MSG, 0, 0, "TOXAV_CALL_STATE_SENDING_V");
|
||||||
|
break;
|
||||||
|
case TOXAV_CALL_STATE_RECEIVING_A:
|
||||||
|
line_info_add(window, NULL, NULL, NULL, SYS_MSG, 0, 0, "TOXAV_CALL_STATE_RECEIVING_A");
|
||||||
|
break;
|
||||||
|
case TOXAV_CALL_STATE_RECEIVING_V:
|
||||||
|
line_info_add(window, NULL, NULL, NULL, SYS_MSG, 0, 0, "TOXAV_CALL_STATE_RECEIVING_V");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void receive_audio_frame_cb(ToxAV *av, uint32_t friend_number, int16_t const *pcm, size_t sample_count, uint8_t channels, uint32_t sampling_rate, void *user_data)
|
||||||
{
|
{
|
||||||
ToxWindow* windows = arg;
|
CallControl* cc = user_data;
|
||||||
|
|
||||||
|
write_device_callback(CallContrl.calls[friend_number].out_idx, friend_number, pcm, frame_size, cc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void audio_bit_rate_status_cb(ToxAV *av, uint32_t friend_number, bool stable, uint32_t bit_rate, void *user_data)
|
||||||
|
{
|
||||||
|
|
||||||
|
CallControl* cc = user_data;
|
||||||
|
|
||||||
|
if (stable)
|
||||||
|
cc->audio_bit_rate = bit_rate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void receive_video_frame_cb(ToxAV *av, uint32_t friend_number,
|
||||||
|
uint16_t width, uint16_t height,
|
||||||
|
uint8_t const *y, uint8_t const *u, uint8_t const *v, uint8_t const *a,
|
||||||
|
int32_t ystride, int32_t ustride, int32_t vstride, int32_t astride,
|
||||||
|
void *user_data)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void video_bit_rate_status_cb(ToxAV *av, uint32_t friend_number,
|
||||||
|
bool stable, uint32_t bit_rate, void *user_data)
|
||||||
|
{
|
||||||
|
CallControl* cc = user_data;
|
||||||
|
|
||||||
|
if (stable)
|
||||||
|
cc->video_bit_rate = bit_rate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define CB_BODY(friend_number, Arg, onFunc) do { ToxWindow* windows = (Arg); int i;\
|
||||||
|
for (i = 0; i < MAX_WINDOWS_NUM; ++i) if (windows[i].onFunc != NULL) windows[i].onFunc(&windows[i], CallContrl.av, friend_number); } while (0)
|
||||||
|
|
||||||
|
|
||||||
|
void callback_recv_invite ( void* av, uint32_t friend_number, void* arg )
|
||||||
|
{
|
||||||
|
//CB_BODY(friend_number, arg, onInvite);
|
||||||
|
CallControl* cc = (CallControl*)arg;
|
||||||
|
ToxWindow* windows = cc->window;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < MAX_WINDOWS_NUM; ++i)
|
for (i = 0; i < MAX_WINDOWS_NUM; ++i)
|
||||||
if (windows[i].onStarting != NULL && windows[i].call_idx == call_index) {
|
if (windows[i].onInvite != NULL && windows[i].num == friend_number) {
|
||||||
windows[i].onStarting(&windows[i], ASettins.av, call_index);
|
windows[i].onInvite(&windows[i], cc->av, friend_number, cc->call_state);
|
||||||
if ( 0 != start_transmission(&windows[i], &ASettins.calls[call_index])) {/* YEAH! */
|
} else {
|
||||||
|
//if(windows[i].num != friend_number)
|
||||||
|
//line_info_add(&windows, NULL, NULL, NULL, SYS_MSG, 0, 0, "Non-matching friend number");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void callback_recv_ringing ( void* av, uint32_t friend_number, void* arg )
|
||||||
|
{
|
||||||
|
//CB_BODY(friend_number, arg, onRinging);
|
||||||
|
CallControl* cc = arg;
|
||||||
|
ToxWindow* windows = cc->window;
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < MAX_WINDOWS_NUM; ++i)
|
||||||
|
if (windows[i].onRinging != NULL && windows[i].num == friend_number) {
|
||||||
|
windows[i].onRinging(&windows[i], cc->av, friend_number, cc->call_state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void callback_recv_starting ( void* av, uint32_t friend_number, void* arg )
|
||||||
|
{
|
||||||
|
CallControl* cc = arg;
|
||||||
|
ToxWindow* windows = cc->window;
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < MAX_WINDOWS_NUM; ++i)
|
||||||
|
if (windows[i].onStarting != NULL && windows[i].num == friend_number) {
|
||||||
|
windows[i].onStarting(&windows[i], cc->av, friend_number, cc->call_state);
|
||||||
|
if ( 0 != start_transmission(&windows[i], &CallContrl.calls[friend_number])) {/* YEAH! */
|
||||||
line_info_add(&windows[i], NULL, NULL, NULL, SYS_MSG, 0, 0 , "Error starting transmission!");
|
line_info_add(&windows[i], NULL, NULL, NULL, SYS_MSG, 0, 0 , "Error starting transmission!");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void callback_recv_ending ( void* av, int32_t call_index, void* arg )
|
void callback_recv_ending ( void* av, uint32_t friend_number, void* arg )
|
||||||
{
|
{
|
||||||
CB_BODY(call_index, arg, onEnding);
|
//CB_BODY(friend_number, arg, onEnding);
|
||||||
stop_transmission(&ASettins.calls[call_index], call_index);
|
|
||||||
}
|
|
||||||
|
|
||||||
void callback_call_started ( void* av, int32_t call_index, void* arg )
|
CallControl* cc = arg;
|
||||||
{
|
ToxWindow* windows = cc->window;
|
||||||
ToxWindow* windows = arg;
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < MAX_WINDOWS_NUM; ++i)
|
for (i = 0; i < MAX_WINDOWS_NUM; ++i)
|
||||||
if (windows[i].onStart != NULL && windows[i].call_idx == call_index) {
|
if (windows[i].onEnding != NULL && windows[i].num == friend_number) {
|
||||||
windows[i].onStart(&windows[i], ASettins.av, call_index);
|
windows[i].onEnding(&windows[i], cc->av, friend_number, cc->call_state);
|
||||||
if ( 0 != start_transmission(&windows[i], &ASettins.calls[call_index]) ) {/* YEAH! */
|
}
|
||||||
|
|
||||||
|
stop_transmission(&CallContrl.calls[friend_number], friend_number);
|
||||||
|
}
|
||||||
|
|
||||||
|
void callback_call_started ( void* av, uint32_t friend_number, void* arg )
|
||||||
|
{
|
||||||
|
CallControl* cc = arg;
|
||||||
|
ToxWindow* windows = cc->window;
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < MAX_WINDOWS_NUM; ++i)
|
||||||
|
if (windows[i].onStart != NULL && windows[i].num == friend_number) {
|
||||||
|
windows[i].onStart(&windows[i], cc->av, friend_number, cc->call_state);
|
||||||
|
if ( 0 != start_transmission(&windows[i], &CallContrl.calls[friend_number]) ) {/* YEAH! */
|
||||||
line_info_add(&windows[i], NULL, NULL, NULL, SYS_MSG, 0, 0, "Error starting transmission!");
|
line_info_add(&windows[i], NULL, NULL, NULL, SYS_MSG, 0, 0, "Error starting transmission!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void callback_call_canceled ( void* av, int32_t call_index, void* arg )
|
void callback_call_canceled ( void* av, uint32_t friend_number, void* arg )
|
||||||
{
|
{
|
||||||
CB_BODY(call_index, arg, onCancel);
|
//CB_BODY(friend_number, arg, onCancel);
|
||||||
|
CallControl* cc = arg;
|
||||||
|
ToxWindow* windows = cc->window;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < MAX_WINDOWS_NUM; ++i)
|
||||||
|
if (windows[i].onCancel != NULL && windows[i].num == friend_number) {
|
||||||
|
windows[i].onCancel(&windows[i], cc->av, friend_number, cc->call_state);
|
||||||
|
}
|
||||||
|
|
||||||
/* In case call is active */
|
/* In case call is active */
|
||||||
stop_transmission(&ASettins.calls[call_index], call_index);
|
stop_transmission(&CallContrl.calls[friend_number], friend_number);
|
||||||
}
|
}
|
||||||
void callback_call_rejected ( void* av, int32_t call_index, void* arg )
|
void callback_call_rejected ( void* av, uint32_t friend_number, void* arg )
|
||||||
{
|
{
|
||||||
CB_BODY(call_index, arg, onReject);
|
//CB_BODY(friend_number, arg, onReject);
|
||||||
}
|
|
||||||
void callback_call_ended ( void* av, int32_t call_index, void* arg )
|
CallControl* cc = arg;
|
||||||
{
|
ToxWindow* windows = cc->window;
|
||||||
CB_BODY(call_index, arg, onEnd);
|
|
||||||
stop_transmission(&ASettins.calls[call_index], call_index);
|
int i;
|
||||||
|
for (i = 0; i < MAX_WINDOWS_NUM; ++i)
|
||||||
|
if (windows[i].onReject != NULL && windows[i].num == friend_number) {
|
||||||
|
windows[i].onReject(&windows[i], cc->av, friend_number, cc->call_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void callback_requ_timeout ( void* av, int32_t call_index, void* arg )
|
|
||||||
{
|
|
||||||
CB_BODY(call_index, arg, onRequestTimeout);
|
|
||||||
}
|
}
|
||||||
void callback_peer_timeout ( void* av, int32_t call_index, void* arg )
|
void callback_call_ended ( void* av, uint32_t friend_number, void* arg )
|
||||||
{
|
{
|
||||||
CB_BODY(call_index, arg, onPeerTimeout);
|
//CB_BODY(friend_number, arg, onEnd);
|
||||||
stop_transmission(&ASettins.calls[call_index], call_index);
|
CallControl* cc = arg;
|
||||||
|
ToxWindow* windows = cc->window;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < MAX_WINDOWS_NUM; ++i)
|
||||||
|
if (windows[i].onEnd != NULL && windows[i].num == friend_number) {
|
||||||
|
windows[i].onEnd(&windows[i], cc->av, friend_number, cc->call_state);
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_transmission(&CallContrl.calls[friend_number], friend_number);
|
||||||
|
}
|
||||||
|
|
||||||
|
void callback_requ_timeout ( void* av, uint32_t friend_number, void* arg )
|
||||||
|
{
|
||||||
|
//CB_BODY(friend_number, arg, onRequestTimeout);
|
||||||
|
CallControl* cc = arg;
|
||||||
|
ToxWindow* windows = cc->window;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < MAX_WINDOWS_NUM; ++i)
|
||||||
|
if (windows[i].onRequestTimeout != NULL && windows[i].num == friend_number) {
|
||||||
|
windows[i].onRequestTimeout(&windows[i], cc->av, friend_number, cc->call_state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void callback_peer_timeout ( void* av, uint32_t friend_number, void* arg )
|
||||||
|
{
|
||||||
|
//CB_BODY(friend_number, arg, onPeerTimeout);
|
||||||
|
CallControl* cc = arg;
|
||||||
|
ToxWindow* windows = cc->window;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < MAX_WINDOWS_NUM; ++i)
|
||||||
|
if (windows[i].onPeerTimeout != NULL && windows[i].num == friend_number) {
|
||||||
|
windows[i].onPeerTimeout(&windows[i], cc->av, friend_number, cc->call_state);
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_transmission(&CallContrl.calls[friend_number], friend_number);
|
||||||
/* Call is stopped manually since there might be some other
|
/* Call is stopped manually since there might be some other
|
||||||
* actions that one can possibly take on timeout
|
* actions that one can possibly take on timeout
|
||||||
*/
|
*/
|
||||||
toxav_stop_call(ASettins.av, call_index);
|
TOXAV_ERR_CALL_CONTROL error;
|
||||||
|
bool call_running = toxav_call_control(cc->av, friend_number, TOXAV_CALL_CONTROL_CANCEL, &error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// void callback_media_change(void* av, int32_t call_index, void* arg)
|
// void callback_media_change(void* av, int32_t friend_number, void* arg)
|
||||||
// {
|
// {
|
||||||
/*... TODO cancel all media change requests */
|
/*... TODO cancel all media change requests */
|
||||||
// }
|
// }
|
||||||
@ -345,6 +581,7 @@ void callback_peer_timeout ( void* av, int32_t call_index, void* arg )
|
|||||||
*/
|
*/
|
||||||
void cmd_call(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
void cmd_call(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||||
{
|
{
|
||||||
|
TOXAV_ERR_CALL error;
|
||||||
const char *error_str;
|
const char *error_str;
|
||||||
|
|
||||||
if (argc != 0) {
|
if (argc != 0) {
|
||||||
@ -352,8 +589,8 @@ void cmd_call(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
|
|||||||
goto on_error;
|
goto on_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !ASettins.av ) {
|
if ( !CallContrl.av ) {
|
||||||
error_str = "Audio not supported!";
|
error_str = "ToxAV not supported!";
|
||||||
goto on_error;
|
goto on_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,16 +599,21 @@ void cmd_call(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
|
|||||||
goto on_error;
|
goto on_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ToxAvError error = toxav_call(ASettins.av, &self->call_idx, self->num, &ASettins.cs, 30);
|
bool call_running;
|
||||||
|
call_running = toxav_call(CallContrl.av, self->num, CallContrl.audio_bit_rate, CallContrl.video_bit_rate, &error);
|
||||||
|
|
||||||
if ( error != av_ErrorNone ) {
|
if ( !call_running ) {
|
||||||
if ( error == av_ErrorAlreadyInCallWithPeer ) error_str = "Already in a call!";
|
if ( error == TOXAV_ERR_CALL_FRIEND_ALREADY_IN_CALL ) error_str = "Already in a call!";
|
||||||
|
else if ( error == TOXAV_ERR_CALL_MALLOC ) error_str = "Resource allocation issue";
|
||||||
|
else if ( error == TOXAV_ERR_CALL_FRIEND_NOT_FOUND) error_str = "Friend number invalid";
|
||||||
|
else if ( error == TOXAV_ERR_CALL_FRIEND_NOT_CONNECTED) error_str = "Friend is valid but not currently connected";
|
||||||
else error_str = "Internal error!";
|
else error_str = "Internal error!";
|
||||||
|
|
||||||
goto on_error;
|
goto on_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Calling... idx: %d", self->call_idx);
|
CallContrl.pending_call = true;
|
||||||
|
callback_recv_ringing(CallContrl.av, self->num, &CallContrl);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
on_error:
|
on_error:
|
||||||
@ -380,6 +622,7 @@ on_error:
|
|||||||
|
|
||||||
void cmd_answer(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
void cmd_answer(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||||
{
|
{
|
||||||
|
TOXAV_ERR_ANSWER error;
|
||||||
const char *error_str;
|
const char *error_str;
|
||||||
|
|
||||||
if (argc != 0) {
|
if (argc != 0) {
|
||||||
@ -387,16 +630,19 @@ void cmd_answer(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
|
|||||||
goto on_error;
|
goto on_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !ASettins.av ) {
|
if ( !CallContrl.av ) {
|
||||||
error_str = "Audio not supported!";
|
error_str = "Audio not supported!";
|
||||||
goto on_error;
|
goto on_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ToxAvError error = toxav_answer(ASettins.av, self->call_idx, &ASettins.cs);
|
bool call_running = toxav_answer(CallContrl.av, self->num, 48, 0, &error);
|
||||||
|
|
||||||
if ( error != av_ErrorNone ) {
|
if ( !call_running ) {
|
||||||
if ( error == av_ErrorInvalidState ) error_str = "Cannot answer in invalid state!";
|
//if ( error != TOXAV_ERR_ANSWER_OK ) error_str = "Cannot answer in invalid state!";
|
||||||
else if ( error == av_ErrorNoCall ) error_str = "No incoming call!";
|
if ( error == TOXAV_ERR_ANSWER_FRIEND_NOT_CALLING ) error_str = "No incoming call!";
|
||||||
|
else if ( error == TOXAV_ERR_ANSWER_CODEC_INITIALIZATION ) error_str = "Failed to initialize codecs";
|
||||||
|
else if ( error == TOXAV_ERR_ANSWER_FRIEND_NOT_FOUND ) error_str = "Friend not found";
|
||||||
|
else if ( error == TOXAV_ERR_ANSWER_INVALID_BIT_RATE ) error_str = "Invalid bit rate";
|
||||||
else error_str = "Internal error!";
|
else error_str = "Internal error!";
|
||||||
|
|
||||||
goto on_error;
|
goto on_error;
|
||||||
@ -404,6 +650,10 @@ void cmd_answer(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
|
|||||||
|
|
||||||
/* Callback will print status... */
|
/* Callback will print status... */
|
||||||
|
|
||||||
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Starting call");
|
||||||
|
CallContrl.pending_call = false;
|
||||||
|
callback_recv_starting(CallContrl.av, self->num, &CallContrl);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
on_error:
|
on_error:
|
||||||
print_err (self, error_str);
|
print_err (self, error_str);
|
||||||
@ -411,6 +661,7 @@ on_error:
|
|||||||
|
|
||||||
void cmd_reject(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
void cmd_reject(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||||
{
|
{
|
||||||
|
TOXAV_ERR_CALL_CONTROL error;
|
||||||
const char *error_str;
|
const char *error_str;
|
||||||
|
|
||||||
if (argc != 0) {
|
if (argc != 0) {
|
||||||
@ -418,16 +669,18 @@ void cmd_reject(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
|
|||||||
goto on_error;
|
goto on_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !ASettins.av ) {
|
if ( !CallContrl.av ) {
|
||||||
error_str = "Audio not supported!";
|
error_str = "Audio not supported!";
|
||||||
goto on_error;
|
goto on_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ToxAvError error = toxav_reject(ASettins.av, self->call_idx, "Why not?");
|
bool call_running;
|
||||||
|
call_running = toxav_call_control(CallContrl.av, self->num, TOXAV_CALL_CONTROL_CANCEL, &error);
|
||||||
|
//ToxAvError error = toxav_reject(CallContrl.av, self->call_idx, "Why not?");
|
||||||
|
|
||||||
if ( error != av_ErrorNone ) {
|
if ( error != TOXAV_ERR_CALL_CONTROL_OK ) {
|
||||||
if ( error == av_ErrorInvalidState ) error_str = "Cannot reject in invalid state!";
|
if ( error == TOXAV_ERR_CALL_CONTROL_INVALID_TRANSITION ) error_str = "Cannot reject in invalid state!";
|
||||||
else if ( error == av_ErrorNoCall ) error_str = "No incoming call!";
|
else if ( CallContrl.pending_call == false ) error_str = "No incoming call!";
|
||||||
else error_str = "Internal error!";
|
else error_str = "Internal error!";
|
||||||
|
|
||||||
goto on_error;
|
goto on_error;
|
||||||
@ -435,6 +688,8 @@ void cmd_reject(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
|
|||||||
|
|
||||||
/* Callback will print status... */
|
/* Callback will print status... */
|
||||||
|
|
||||||
|
CallContrl.pending_call = false;
|
||||||
|
callback_call_rejected(CallContrl.av, self->num, &CallContrl);
|
||||||
return;
|
return;
|
||||||
on_error:
|
on_error:
|
||||||
print_err (self, error_str);
|
print_err (self, error_str);
|
||||||
@ -442,6 +697,7 @@ on_error:
|
|||||||
|
|
||||||
void cmd_hangup(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
void cmd_hangup(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||||
{
|
{
|
||||||
|
TOXAV_ERR_CALL_CONTROL error;
|
||||||
const char *error_str;
|
const char *error_str;
|
||||||
|
|
||||||
if (argc != 0) {
|
if (argc != 0) {
|
||||||
@ -449,27 +705,27 @@ void cmd_hangup(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
|
|||||||
goto on_error;
|
goto on_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !ASettins.av ) {
|
if ( !CallContrl.av ) {
|
||||||
error_str = "Audio not supported!";
|
error_str = "Audio not supported!";
|
||||||
goto on_error;
|
goto on_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ToxAvError error;
|
bool call_running;
|
||||||
|
if( CallContrl.call_state != TOXAV_CALL_STATE_SENDING_A | TOXAV_CALL_STATE_RECEIVING_A | TOXAV_CALL_STATE_SENDING_V | TOXAV_CALL_STATE_RECEIVING_V ) {
|
||||||
if (toxav_get_call_state(ASettins.av, self->call_idx) == av_CallInviting) {
|
call_running = toxav_call_control(CallContrl.av, self->num, TOXAV_CALL_CONTROL_CANCEL, &error);
|
||||||
error = toxav_cancel(ASettins.av, self->call_idx, self->num,
|
|
||||||
"Only those who appreciate small things know the beauty that is life");
|
|
||||||
#ifdef SOUND_NOTIFY
|
#ifdef SOUND_NOTIFY
|
||||||
stop_sound(self->ringing_sound);
|
stop_sound(self->ringing_sound);
|
||||||
#endif
|
#endif
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Call canceled!");
|
CallContrl.pending_call = false;
|
||||||
|
callback_call_canceled(CallContrl.av, self->num, &CallContrl);
|
||||||
} else {
|
} else {
|
||||||
error = toxav_hangup(ASettins.av, self->call_idx);
|
call_running = toxav_call_control(CallContrl.av, &self->num, TOXAV_CALL_CONTROL_CANCEL, &error);
|
||||||
|
callback_call_ended(CallContrl.av, self->num, &CallContrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( error != av_ErrorNone ) {
|
if ( error != TOXAV_ERR_CALL_CONTROL_OK ) {
|
||||||
if ( error == av_ErrorInvalidState ) error_str = "Cannot hangup in invalid state!";
|
if ( error == TOXAV_ERR_CALL_CONTROL_INVALID_TRANSITION ) error_str = "Cannot hangup in invalid state!";
|
||||||
else if ( error == av_ErrorNoCall ) error_str = "No call!";
|
else if ( error == TOXAV_ERR_CALL_CONTROL_FRIEND_NOT_IN_CALL ) error_str = "No call!";
|
||||||
else error_str = "Internal error!";
|
else error_str = "Internal error!";
|
||||||
|
|
||||||
goto on_error;
|
goto on_error;
|
||||||
@ -596,28 +852,28 @@ void cmd_ccur_device(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*a
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If call is active, change device */
|
/* If call is active, change device */
|
||||||
if ( self->call_idx > -1) {
|
if ( self->num > -1) {
|
||||||
Call* this_call = &ASettins.calls[self->call_idx];
|
Call* this_call = &CallContrl.calls[self->num];
|
||||||
if (this_call->ttas) {
|
if (this_call->ttas) {
|
||||||
|
|
||||||
ToxAvCSettings csettings;
|
//ToxAvCSettings csettings;
|
||||||
toxav_get_peer_csettings(ASettins.av, self->call_idx, 0, &csettings);
|
//toxav_get_peer_csettings(CallContrl.av, self->num, 0, &csettings);
|
||||||
|
|
||||||
if (type == output) {
|
if (type == output) {
|
||||||
pthread_mutex_lock(&this_call->mutex);
|
pthread_mutex_lock(&this_call->mutex);
|
||||||
close_device(output, this_call->out_idx);
|
close_device(output, this_call->out_idx);
|
||||||
this_call->has_output = open_device(output, selection, &this_call->out_idx,
|
this_call->has_output = open_device(output, selection, &this_call->out_idx,
|
||||||
csettings.audio_sample_rate, csettings.audio_frame_duration, csettings.audio_channels)
|
CallContrl.audio_bit_rate, CallContrl.audio_frame_duration, CallContrl.audio_channels)
|
||||||
== de_None ? 1 : 0;
|
== de_None ? 1 : 0;
|
||||||
pthread_mutex_unlock(&this_call->mutex);
|
pthread_mutex_unlock(&this_call->mutex);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* TODO: check for failure */
|
/* TODO: check for failure */
|
||||||
close_device(input, this_call->in_idx);
|
close_device(input, this_call->in_idx);
|
||||||
open_device(input, selection, &this_call->in_idx, csettings.audio_sample_rate,
|
open_device(input, selection, &this_call->in_idx, CallContrl.audio_bit_rate,
|
||||||
csettings.audio_frame_duration, csettings.audio_channels);
|
CallContrl.audio_frame_duration, CallContrl.audio_channels);
|
||||||
/* Set VAD as true for all; TODO: Make it more dynamic */
|
/* Set VAD as true for all; TODO: Make it more dynamic */
|
||||||
register_device_callback(self->call_idx, this_call->in_idx, read_device_callback, &self->call_idx, true);
|
register_device_callback(self->num, this_call->in_idx, read_device_callback, &self->num, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -655,8 +911,8 @@ void cmd_mute(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
|
|||||||
|
|
||||||
|
|
||||||
/* If call is active, use this_call values */
|
/* If call is active, use this_call values */
|
||||||
if ( self->call_idx > -1) {
|
if ( self->num > -1) {
|
||||||
Call* this_call = &ASettins.calls[self->call_idx];
|
Call* this_call = &CallContrl.calls[self->num];
|
||||||
|
|
||||||
pthread_mutex_lock(&this_call->mutex);
|
pthread_mutex_lock(&this_call->mutex);
|
||||||
if (type == input) {
|
if (type == input) {
|
||||||
@ -695,8 +951,8 @@ void cmd_sense(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[M
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Call must be active */
|
/* Call must be active */
|
||||||
if ( self->call_idx > -1) {
|
if ( self->num > -1) {
|
||||||
device_set_VAD_treshold(ASettins.calls[self->call_idx].in_idx, value);
|
device_set_VAD_treshold(CallContrl.calls[self->num].in_idx, value);
|
||||||
self->chatwin->infobox.vad_lvl = value;
|
self->chatwin->infobox.vad_lvl = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -709,23 +965,31 @@ on_error:
|
|||||||
|
|
||||||
void stop_current_call(ToxWindow* self)
|
void stop_current_call(ToxWindow* self)
|
||||||
{
|
{
|
||||||
|
TOXAV_ERR_CALL_CONTROL error;
|
||||||
|
bool call_running = toxav_call_control(CallContrl.av, &self->num, TOXAV_CALL_CONTROL_CANCEL, &error);
|
||||||
|
|
||||||
|
/*
|
||||||
ToxAvCallState callstate;
|
ToxAvCallState callstate;
|
||||||
if ( ASettins.av != NULL && self->call_idx != -1 &&
|
if ( CallContrl.av != NULL && self->num != -1 &&
|
||||||
( callstate = toxav_get_call_state(ASettins.av, self->call_idx) ) != av_CallNonExistent) {
|
CallContrl.call_state != TOXAV_CALL_STATE_SENDING_A | TOXAV_CALL_STATE_RECEIVING_A | TOXAV_CALL_STATE_SENDING_V | TOXAV_CALL_STATE_RECEIVING_V) {
|
||||||
switch (callstate)
|
switch (callstate)
|
||||||
{
|
{
|
||||||
case av_CallActive:
|
case av_CallActive:
|
||||||
case av_CallHold:
|
case av_CallHold:
|
||||||
toxav_hangup(ASettins.av, self->call_idx);
|
//toxav_hangup(CallContrl.av, self->num);
|
||||||
|
toxav_call_control(CallContrl.av, &self->num, TOXAV_CALL_CONTROL_CANCEL, &error);
|
||||||
break;
|
break;
|
||||||
case av_CallInviting:
|
case av_CallInviting:
|
||||||
toxav_cancel(ASettins.av, self->call_idx, 0, "Not interested anymore");
|
//toxav_cancel(CallContrl.av, self->num, 0, "Not interested anymore");
|
||||||
|
toxav_call_control(CallContrl.av, &self->num, TOXAV_CALL_CONTROL_CANCEL, &error);
|
||||||
break;
|
break;
|
||||||
case av_CallStarting:
|
case av_CallStarting:
|
||||||
toxav_reject(ASettins.av, self->call_idx, "Not interested");
|
//toxav_reject(CallContrl.av, self->num, "Not interested");
|
||||||
|
toxav_call_control(CallContrl.av, &self->num, TOXAV_CALL_CONTROL_CANCEL, &error);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
@ -42,10 +42,10 @@ typedef struct Call {
|
|||||||
} Call;
|
} Call;
|
||||||
|
|
||||||
/* You will have to pass pointer to first member of 'windows' declared in windows.c */
|
/* You will have to pass pointer to first member of 'windows' declared in windows.c */
|
||||||
ToxAv *init_audio(ToxWindow *self, Tox *tox);
|
ToxAV *init_audio(ToxWindow *self, Tox *tox);
|
||||||
void terminate_audio();
|
void terminate_audio();
|
||||||
int start_transmission(ToxWindow *self, Call *call);
|
int start_transmission(ToxWindow *self, Call *call);
|
||||||
int stop_transmission(Call *call, int call_index);
|
int stop_transmission(Call *call, int friend_number);
|
||||||
void stop_current_call(ToxWindow *self);
|
void stop_current_call(ToxWindow *self);
|
||||||
|
|
||||||
#endif /* AUDIO_H */
|
#endif /* AUDIO_H */
|
||||||
|
@ -57,7 +57,7 @@ typedef struct Device {
|
|||||||
ALCcontext *ctx; /* Device context */
|
ALCcontext *ctx; /* Device context */
|
||||||
DataHandleCallback cb; /* Use this to handle data from input device usually */
|
DataHandleCallback cb; /* Use this to handle data from input device usually */
|
||||||
void* cb_data; /* Data to be passed to callback */
|
void* cb_data; /* Data to be passed to callback */
|
||||||
int32_t call_idx; /* ToxAv call index */
|
int32_t friend_number; /* ToxAV friend number */
|
||||||
|
|
||||||
uint32_t source, buffers[OPENAL_BUFS]; /* Playback source/buffers */
|
uint32_t source, buffers[OPENAL_BUFS]; /* Playback source/buffers */
|
||||||
uint32_t ref_count;
|
uint32_t ref_count;
|
||||||
@ -80,7 +80,7 @@ Device *running[2][MAX_DEVICES] = {{NULL}}; /* Running devices */
|
|||||||
uint32_t primary_device[2]; /* Primary device */
|
uint32_t primary_device[2]; /* Primary device */
|
||||||
|
|
||||||
#ifdef AUDIO
|
#ifdef AUDIO
|
||||||
static ToxAv* av = NULL;
|
static ToxAV* av = NULL;
|
||||||
#endif /* AUDIO */
|
#endif /* AUDIO */
|
||||||
|
|
||||||
/* q_mutex */
|
/* q_mutex */
|
||||||
@ -95,7 +95,7 @@ bool thread_running = true,
|
|||||||
void* thread_poll(void*);
|
void* thread_poll(void*);
|
||||||
/* Meet devices */
|
/* Meet devices */
|
||||||
#ifdef AUDIO
|
#ifdef AUDIO
|
||||||
DeviceError init_devices(ToxAv* av_)
|
DeviceError init_devices(ToxAV* av_)
|
||||||
#else
|
#else
|
||||||
DeviceError init_devices()
|
DeviceError init_devices()
|
||||||
#endif /* AUDIO */
|
#endif /* AUDIO */
|
||||||
@ -339,7 +339,7 @@ DeviceError close_device(DeviceType type, uint32_t device_idx)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceError register_device_callback( int32_t call_idx, uint32_t device_idx, DataHandleCallback callback, void* data, bool enable_VAD)
|
DeviceError register_device_callback( int32_t friend_number, uint32_t device_idx, DataHandleCallback callback, void* data, bool enable_VAD)
|
||||||
{
|
{
|
||||||
if (size[input] <= device_idx || !running[input][device_idx] || running[input][device_idx]->dhndl == NULL)
|
if (size[input] <= device_idx || !running[input][device_idx] || running[input][device_idx]->dhndl == NULL)
|
||||||
return de_InvalidSelection;
|
return de_InvalidSelection;
|
||||||
@ -348,7 +348,7 @@ DeviceError register_device_callback( int32_t call_idx, uint32_t device_idx, Dat
|
|||||||
running[input][device_idx]->cb = callback;
|
running[input][device_idx]->cb = callback;
|
||||||
running[input][device_idx]->cb_data = data;
|
running[input][device_idx]->cb_data = data;
|
||||||
running[input][device_idx]->enable_VAD = enable_VAD;
|
running[input][device_idx]->enable_VAD = enable_VAD;
|
||||||
running[input][device_idx]->call_idx = call_idx;
|
running[input][device_idx]->friend_number = friend_number;
|
||||||
unlock;
|
unlock;
|
||||||
|
|
||||||
return de_None;
|
return de_None;
|
||||||
|
@ -56,7 +56,7 @@ typedef void (*DataHandleCallback) (const int16_t*, uint32_t size, void* data);
|
|||||||
|
|
||||||
|
|
||||||
#ifdef AUDIO
|
#ifdef AUDIO
|
||||||
DeviceError init_devices(ToxAv* av);
|
DeviceError init_devices(ToxAV* av);
|
||||||
#else
|
#else
|
||||||
DeviceError init_devices();
|
DeviceError init_devices();
|
||||||
#endif /* AUDIO */
|
#endif /* AUDIO */
|
||||||
|
66
src/chat.c
66
src/chat.c
@ -552,29 +552,27 @@ static void chat_onGroupInvite(ToxWindow *self, Tox *m, int32_t friendnumber, ui
|
|||||||
/* Av Stuff */
|
/* Av Stuff */
|
||||||
#ifdef AUDIO
|
#ifdef AUDIO
|
||||||
|
|
||||||
void chat_onInvite (ToxWindow *self, ToxAv *av, int call_index)
|
void chat_onInvite (ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||||
{
|
{
|
||||||
if (!self || self->num != toxav_get_peer_id(av, call_index, 0))
|
if (!self || self->num != friend_number)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* call_index is set here and reset on call end */
|
/* friend_number is set here and reset on call end */
|
||||||
|
self->num = (int)friend_number;
|
||||||
self->call_idx = call_index;
|
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Incoming audio call! Type: \"/answer\" or \"/reject\"");
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Incoming audio call! Type: \"/answer\" or \"/reject\"");
|
||||||
|
|
||||||
if (self->ringing_sound == -1)
|
if (self->ringing_sound == -1)
|
||||||
sound_notify(self, call_incoming, NT_LOOP, &self->ringing_sound);
|
sound_notify(self, call_incoming, NT_LOOP, &self->ringing_sound);
|
||||||
|
|
||||||
|
|
||||||
if (self->active_box != -1)
|
if (self->active_box != -1)
|
||||||
box_silent_notify2(self, NT_NOFOCUS | NT_WNDALERT_0, self->active_box, "Incoming audio call!");
|
box_silent_notify2(self, NT_NOFOCUS | NT_WNDALERT_0, self->active_box, "Incoming audio call!");
|
||||||
else
|
else
|
||||||
box_silent_notify(self, NT_NOFOCUS | NT_WNDALERT_0, &self->active_box, self->name, "Incoming audio call!");
|
box_silent_notify(self, NT_NOFOCUS | NT_WNDALERT_0, &self->active_box, self->name, "Incoming audio call!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void chat_onRinging (ToxWindow *self, ToxAv *av, int call_index)
|
void chat_onRinging (ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||||
{
|
{
|
||||||
if ( !self || self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
|
if (!self || self->num != friend_number)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Ringing...type \"/hangup\" to cancel it.");
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Ringing...type \"/hangup\" to cancel it.");
|
||||||
@ -585,9 +583,9 @@ void chat_onRinging (ToxWindow *self, ToxAv *av, int call_index)
|
|||||||
#endif /* SOUND_NOTIFY */
|
#endif /* SOUND_NOTIFY */
|
||||||
}
|
}
|
||||||
|
|
||||||
void chat_onStarting (ToxWindow *self, ToxAv *av, int call_index)
|
void chat_onStarting (ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||||
{
|
{
|
||||||
if ( !self || self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
|
if (!self || self->num != friend_number)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
init_infobox(self);
|
init_infobox(self);
|
||||||
@ -599,13 +597,13 @@ void chat_onStarting (ToxWindow *self, ToxAv *av, int call_index)
|
|||||||
#endif /* SOUND_NOTIFY */
|
#endif /* SOUND_NOTIFY */
|
||||||
}
|
}
|
||||||
|
|
||||||
void chat_onEnding (ToxWindow *self, ToxAv *av, int call_index)
|
void chat_onEnding (ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||||
{
|
{
|
||||||
if (!self || self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
|
if (!self || self->num != friend_number)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
kill_infobox(self);
|
kill_infobox(self);
|
||||||
self->call_idx = -1;
|
//self->num = -1;
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Call ended!");
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Call ended!");
|
||||||
|
|
||||||
#ifdef SOUND_NOTIFY
|
#ifdef SOUND_NOTIFY
|
||||||
@ -613,12 +611,12 @@ void chat_onEnding (ToxWindow *self, ToxAv *av, int call_index)
|
|||||||
#endif /* SOUND_NOTIFY */
|
#endif /* SOUND_NOTIFY */
|
||||||
}
|
}
|
||||||
|
|
||||||
void chat_onError (ToxWindow *self, ToxAv *av, int call_index)
|
void chat_onError (ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||||
{
|
{
|
||||||
if (!self || self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
|
if (!self || self->num != friend_number)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
self->call_idx = -1;
|
//self->num = -1;
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Error!");
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Error!");
|
||||||
|
|
||||||
#ifdef SOUND_NOTIFY
|
#ifdef SOUND_NOTIFY
|
||||||
@ -626,9 +624,9 @@ void chat_onError (ToxWindow *self, ToxAv *av, int call_index)
|
|||||||
#endif /* SOUND_NOTIFY */
|
#endif /* SOUND_NOTIFY */
|
||||||
}
|
}
|
||||||
|
|
||||||
void chat_onStart (ToxWindow *self, ToxAv *av, int call_index)
|
void chat_onStart (ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||||
{
|
{
|
||||||
if ( !self || self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
|
if (!self || self->num != friend_number)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
init_infobox(self);
|
init_infobox(self);
|
||||||
@ -640,13 +638,13 @@ void chat_onStart (ToxWindow *self, ToxAv *av, int call_index)
|
|||||||
#endif /* SOUND_NOTIFY */
|
#endif /* SOUND_NOTIFY */
|
||||||
}
|
}
|
||||||
|
|
||||||
void chat_onCancel (ToxWindow *self, ToxAv *av, int call_index)
|
void chat_onCancel (ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||||
{
|
{
|
||||||
if ( !self || self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
|
if (!self || self->num != friend_number)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
kill_infobox(self);
|
kill_infobox(self);
|
||||||
self->call_idx = -1;
|
//self->num = -1;
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Call canceled!");
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Call canceled!");
|
||||||
|
|
||||||
#ifdef SOUND_NOTIFY
|
#ifdef SOUND_NOTIFY
|
||||||
@ -654,12 +652,12 @@ void chat_onCancel (ToxWindow *self, ToxAv *av, int call_index)
|
|||||||
#endif /* SOUND_NOTIFY */
|
#endif /* SOUND_NOTIFY */
|
||||||
}
|
}
|
||||||
|
|
||||||
void chat_onReject (ToxWindow *self, ToxAv *av, int call_index)
|
void chat_onReject (ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||||
{
|
{
|
||||||
if (!self || self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
|
if (!self || self->num != friend_number)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
self->call_idx = -1;
|
//self->num = -1;
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Rejected!");
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Rejected!");
|
||||||
|
|
||||||
#ifdef SOUND_NOTIFY
|
#ifdef SOUND_NOTIFY
|
||||||
@ -667,13 +665,13 @@ void chat_onReject (ToxWindow *self, ToxAv *av, int call_index)
|
|||||||
#endif /* SOUND_NOTIFY */
|
#endif /* SOUND_NOTIFY */
|
||||||
}
|
}
|
||||||
|
|
||||||
void chat_onEnd (ToxWindow *self, ToxAv *av, int call_index)
|
void chat_onEnd (ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||||
{
|
{
|
||||||
if (!self || self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
|
if (!self || self->num != friend_number)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
kill_infobox(self);
|
kill_infobox(self);
|
||||||
self->call_idx = -1;
|
//self->num = -1;
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Call ended!");
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Call ended!");
|
||||||
|
|
||||||
#ifdef SOUND_NOTIFY
|
#ifdef SOUND_NOTIFY
|
||||||
@ -681,12 +679,12 @@ void chat_onEnd (ToxWindow *self, ToxAv *av, int call_index)
|
|||||||
#endif /* SOUND_NOTIFY */
|
#endif /* SOUND_NOTIFY */
|
||||||
}
|
}
|
||||||
|
|
||||||
void chat_onRequestTimeout (ToxWindow *self, ToxAv *av, int call_index)
|
void chat_onRequestTimeout (ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||||
{
|
{
|
||||||
if (!self || self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
|
if (!self || self->num != friend_number)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
self->call_idx = -1;
|
//self->num = -1;
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "No answer!");
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "No answer!");
|
||||||
|
|
||||||
#ifdef SOUND_NOTIFY
|
#ifdef SOUND_NOTIFY
|
||||||
@ -694,13 +692,13 @@ void chat_onRequestTimeout (ToxWindow *self, ToxAv *av, int call_index)
|
|||||||
#endif /* SOUND_NOTIFY */
|
#endif /* SOUND_NOTIFY */
|
||||||
}
|
}
|
||||||
|
|
||||||
void chat_onPeerTimeout (ToxWindow *self, ToxAv *av, int call_index)
|
void chat_onPeerTimeout (ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||||
{
|
{
|
||||||
if (!self || self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
|
if (!self || self->num != friend_number)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
kill_infobox(self);
|
kill_infobox(self);
|
||||||
self->call_idx = -1;
|
//self->num = -1;
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Peer disconnected; call ended!");
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Peer disconnected; call ended!");
|
||||||
|
|
||||||
#ifdef SOUND_NOTIFY
|
#ifdef SOUND_NOTIFY
|
||||||
@ -1130,7 +1128,7 @@ ToxWindow new_chat(Tox *m, uint32_t friendnum)
|
|||||||
ret.onRequestTimeout = &chat_onRequestTimeout;
|
ret.onRequestTimeout = &chat_onRequestTimeout;
|
||||||
ret.onPeerTimeout = &chat_onPeerTimeout;
|
ret.onPeerTimeout = &chat_onPeerTimeout;
|
||||||
|
|
||||||
ret.call_idx = -1;
|
ret.num = -1;
|
||||||
ret.device_selection[0] = ret.device_selection[1] = -1;
|
ret.device_selection[0] = ret.device_selection[1] = -1;
|
||||||
ret.ringing_sound = -1;
|
ret.ringing_sound = -1;
|
||||||
#endif /* AUDIO */
|
#endif /* AUDIO */
|
||||||
|
@ -120,11 +120,11 @@ void cmd_join_group(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*ar
|
|||||||
|
|
||||||
if (type == TOX_GROUPCHAT_TYPE_TEXT)
|
if (type == TOX_GROUPCHAT_TYPE_TEXT)
|
||||||
groupnum = tox_join_groupchat(m, self->num, (uint8_t *) groupkey, length);
|
groupnum = tox_join_groupchat(m, self->num, (uint8_t *) groupkey, length);
|
||||||
#ifdef AUDIO
|
/*#ifdef AUDIO
|
||||||
else
|
else
|
||||||
groupnum = toxav_join_av_groupchat(m, self->num, (uint8_t *) groupkey, length,
|
groupnum = toxav_join_av_groupchat(m, self->num, (uint8_t *) groupkey, length,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
#endif
|
#endif*/
|
||||||
|
|
||||||
if (groupnum == -1) {
|
if (groupnum == -1) {
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Group chat instance failed to initialize.");
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Group chat instance failed to initialize.");
|
||||||
|
@ -1048,23 +1048,25 @@ void disable_chatwin(uint32_t f_num)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef AUDIO
|
#ifdef AUDIO
|
||||||
static void friendlist_onAv(ToxWindow *self, ToxAv *av, int call_index)
|
static void friendlist_onAV(ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||||
{
|
{
|
||||||
int id = toxav_get_peer_id(av, call_index, 0);
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "friendlist_onAV fired");
|
||||||
|
if( friend_number >= Friends.max_idx)
|
||||||
if ( id != av_ErrorUnknown && id >= Friends.max_idx)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
Tox *m = toxav_get_tox(av);
|
Tox *m = toxav_get_tox(av);
|
||||||
|
|
||||||
if (Friends.list[id].chatwin == -1) {
|
if (Friends.list[friend_number].chatwin == -1) {
|
||||||
if (get_num_active_windows() < MAX_WINDOWS_NUM) {
|
if (get_num_active_windows() < MAX_WINDOWS_NUM) {
|
||||||
if (toxav_get_call_state(av, call_index) == av_CallStarting) { /* Only open windows when call is incoming */
|
//line_info_add(prompt, NULL, NULL, NULL, SYS_MSG, 0, 0, "List number %d", Friends.list[friend_number].num);
|
||||||
Friends.list[id].chatwin = add_window(m, new_chat(m, Friends.list[id].num));
|
if(state != TOXAV_CALL_STATE_FINISHED) {
|
||||||
|
Friends.list[friend_number].chatwin = add_window(m, new_chat(m, Friends.list[friend_number].num));
|
||||||
|
set_active_window(Friends.list[friend_number].chatwin);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
char nick[TOX_MAX_NAME_LENGTH];
|
char nick[TOX_MAX_NAME_LENGTH];
|
||||||
get_nick_truncate(m, nick, Friends.list[id].num);
|
get_nick_truncate(m, nick, Friends.list[friend_number].num);
|
||||||
line_info_add(prompt, NULL, NULL, NULL, SYS_MSG, 0, 0, "Audio action from: %s!", nick);
|
line_info_add(prompt, NULL, NULL, NULL, SYS_MSG, 0, 0, "Audio action from: %s!", nick);
|
||||||
|
|
||||||
const char *errmsg = "* Warning: Too many windows are open.";
|
const char *errmsg = "* Warning: Too many windows are open.";
|
||||||
@ -1096,19 +1098,19 @@ ToxWindow new_friendlist(void)
|
|||||||
ret.onGroupInvite = &friendlist_onGroupInvite;
|
ret.onGroupInvite = &friendlist_onGroupInvite;
|
||||||
|
|
||||||
#ifdef AUDIO
|
#ifdef AUDIO
|
||||||
ret.onInvite = &friendlist_onAv;
|
ret.onInvite = &friendlist_onAV;
|
||||||
ret.onRinging = &friendlist_onAv;
|
ret.onRinging = &friendlist_onAV;
|
||||||
ret.onStarting = &friendlist_onAv;
|
ret.onStarting = &friendlist_onAV;
|
||||||
ret.onEnding = &friendlist_onAv;
|
ret.onEnding = &friendlist_onAV;
|
||||||
ret.onError = &friendlist_onAv;
|
ret.onError = &friendlist_onAV;
|
||||||
ret.onStart = &friendlist_onAv;
|
ret.onStart = &friendlist_onAV;
|
||||||
ret.onCancel = &friendlist_onAv;
|
ret.onCancel = &friendlist_onAV;
|
||||||
ret.onReject = &friendlist_onAv;
|
ret.onReject = &friendlist_onAV;
|
||||||
ret.onEnd = &friendlist_onAv;
|
ret.onEnd = &friendlist_onAV;
|
||||||
ret.onRequestTimeout = &friendlist_onAv;
|
ret.onRequestTimeout = &friendlist_onAV;
|
||||||
ret.onPeerTimeout = &friendlist_onAv;
|
ret.onPeerTimeout = &friendlist_onAV;
|
||||||
|
|
||||||
ret.call_idx = -1;
|
ret.num = -1;
|
||||||
ret.device_selection[0] = ret.device_selection[1] = -1;
|
ret.device_selection[0] = ret.device_selection[1] = -1;
|
||||||
#endif /* AUDIO */
|
#endif /* AUDIO */
|
||||||
|
|
||||||
|
@ -339,10 +339,10 @@ void cmd_groupchat(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*arg
|
|||||||
|
|
||||||
if (type == TOX_GROUPCHAT_TYPE_TEXT)
|
if (type == TOX_GROUPCHAT_TYPE_TEXT)
|
||||||
groupnum = tox_add_groupchat(m);
|
groupnum = tox_add_groupchat(m);
|
||||||
#ifdef AUDIO
|
/*#ifdef AUDIO
|
||||||
else
|
else
|
||||||
groupnum = toxav_add_av_groupchat(m, NULL, NULL);
|
groupnum = toxav_add_av_groupchat(m, NULL, NULL);
|
||||||
#endif
|
#endif*/
|
||||||
|
|
||||||
if (groupnum == -1) {
|
if (groupnum == -1) {
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Group chat instance failed to initialize.");
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Group chat instance failed to initialize.");
|
||||||
|
16
src/toxic.c
16
src/toxic.c
@ -69,7 +69,7 @@
|
|||||||
#ifdef VIDEO
|
#ifdef VIDEO
|
||||||
#include "video_call.h"
|
#include "video_call.h"
|
||||||
#endif /* VIDEO */
|
#endif /* VIDEO */
|
||||||
ToxAv *av;
|
ToxAV *av;
|
||||||
#endif /* AUDIO */
|
#endif /* AUDIO */
|
||||||
|
|
||||||
#ifndef PACKAGE_DATADIR
|
#ifndef PACKAGE_DATADIR
|
||||||
@ -841,14 +841,14 @@ void *thread_cqueue(void *data)
|
|||||||
#ifdef AUDIO
|
#ifdef AUDIO
|
||||||
void *thread_audio(void *data)
|
void *thread_audio(void *data)
|
||||||
{
|
{
|
||||||
ToxAv *av = (ToxAv *) data;
|
ToxAV *av = (ToxAV *) data;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
pthread_mutex_lock(&Winthread.lock);
|
pthread_mutex_lock(&Winthread.lock);
|
||||||
toxav_do(av);
|
toxav_iterate(av);
|
||||||
pthread_mutex_unlock(&Winthread.lock);
|
pthread_mutex_unlock(&Winthread.lock);
|
||||||
|
|
||||||
usleep(toxav_do_interval(av) * 1000);
|
usleep(2 * 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* AUDIO */
|
#endif /* AUDIO */
|
||||||
@ -1140,10 +1140,10 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
av = init_audio(prompt, m);
|
av = init_audio(prompt, m);
|
||||||
|
|
||||||
#ifdef VIDEO
|
//#ifdef VIDEO
|
||||||
av = init_video(prompt, m, av);
|
// av = init_video(prompt, m, av);
|
||||||
|
//
|
||||||
#endif /* VIDEO*/
|
//#endif /* VIDEO*/
|
||||||
|
|
||||||
/* audio thread */
|
/* audio thread */
|
||||||
if (pthread_create(&audio_thread.tid, NULL, thread_audio, (void *) av) != 0)
|
if (pthread_create(&audio_thread.tid, NULL, thread_audio, (void *) av) != 0)
|
||||||
|
@ -41,54 +41,14 @@
|
|||||||
|
|
||||||
#define MAX_CALLS 10
|
#define MAX_CALLS 10
|
||||||
|
|
||||||
struct VSettings {
|
ToxAV *init_video(ToxWindow *self, Tox *tox, ToxAV *av)
|
||||||
VideoError errors;
|
|
||||||
|
|
||||||
ToxAv *av;
|
|
||||||
|
|
||||||
ToxAvCSettings cs;
|
|
||||||
|
|
||||||
Call calls[MAX_CALLS];
|
|
||||||
} VSettins;
|
|
||||||
|
|
||||||
ToxAv *init_video(ToxWindow *self, Tox *tox, ToxAv *av)
|
|
||||||
{
|
{
|
||||||
VSettins.cs = av_DefaultSettings;
|
|
||||||
VSettins.cs.max_video_height = 1024;
|
|
||||||
VSettins.cs.max_video_width = 1024;
|
|
||||||
|
|
||||||
VSettins.errors = ve_None;
|
|
||||||
|
|
||||||
VSettins.av = av;
|
|
||||||
|
|
||||||
memset(VSettins.calls, 0, sizeof(VSettins.calls));
|
|
||||||
|
|
||||||
if( !VSettins.av ) {
|
|
||||||
//line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "New toxav instance");
|
|
||||||
VSettins.av = toxav_new(tox, MAX_CALLS);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !VSettins.av ) {
|
|
||||||
VSettins.errors |= ve_StartingCoreVideo;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( init_video_devices(VSettins.av) == vde_InternalError ) {
|
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to init video devices");
|
|
||||||
//toxav_kill(VSettins.av);
|
|
||||||
return VSettins.av = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return VSettins.av;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void terminate_video()
|
void terminate_video()
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
for (i = 0; i < MAX_CALLS; ++i)
|
|
||||||
stop_video_transmission(&VSettins.calls[i], i);
|
|
||||||
|
|
||||||
terminate_video_devices();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int start_video_transmission(ToxWindow *self, Call *call)
|
int start_video_transmission(ToxWindow *self, Call *call)
|
||||||
@ -97,7 +57,7 @@ int start_video_transmission(ToxWindow *self, Call *call)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int stop_video_transmission(Call *call, int call_index)
|
int stop_video_transmission(Call *call, int friend_number)
|
||||||
{
|
{
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -36,10 +36,10 @@ typedef enum _VideoError {
|
|||||||
} VideoError;
|
} VideoError;
|
||||||
|
|
||||||
/* You will have to pass pointer to first member of 'windows' declared in windows.c */
|
/* You will have to pass pointer to first member of 'windows' declared in windows.c */
|
||||||
ToxAv *init_video(ToxWindow *self, Tox *tox, ToxAv *av);
|
ToxAV *init_video(ToxWindow *self, Tox *tox, ToxAV *av);
|
||||||
void terminate_video();
|
void terminate_video();
|
||||||
int start_video_transmission(ToxWindow *self, Call *call);
|
int start_video_transmission(ToxWindow *self, Call *call);
|
||||||
int stop_video_transmission(Call *call, int call_index);
|
int stop_video_transmission(Call *call, int friend_number);
|
||||||
void stop_current_video_call(ToxWindow *self);
|
void stop_current_video_call(ToxWindow *self);
|
||||||
|
|
||||||
#endif /* VIDEO_H */
|
#endif /* VIDEO_H */
|
@ -78,7 +78,7 @@ VideoDevice *video_device_running[2][MAX_DEVICES] = {{NULL}};
|
|||||||
uint32_t primary_video_device[2];
|
uint32_t primary_video_device[2];
|
||||||
|
|
||||||
#ifdef VIDEO
|
#ifdef VIDEO
|
||||||
static ToxAv* av = NULL;
|
static ToxAV* av = NULL;
|
||||||
#endif /* VIDEO */
|
#endif /* VIDEO */
|
||||||
|
|
||||||
pthread_mutex_t video_mutex;
|
pthread_mutex_t video_mutex;
|
||||||
@ -89,7 +89,7 @@ bool video_thread_running = true,
|
|||||||
void* video_thread_poll(void*);
|
void* video_thread_poll(void*);
|
||||||
/* Meet devices */
|
/* Meet devices */
|
||||||
#ifdef VIDEO
|
#ifdef VIDEO
|
||||||
VideoDeviceError init_video_devices(ToxAv* av_)
|
VideoDeviceError init_video_devices(ToxAV* av_)
|
||||||
#else
|
#else
|
||||||
VideoDeviceError init_video_devices()
|
VideoDeviceError init_video_devices()
|
||||||
#endif /* AUDIO */
|
#endif /* AUDIO */
|
||||||
|
@ -49,7 +49,7 @@ typedef enum VideoDeviceError {
|
|||||||
} VideoDeviceError;
|
} VideoDeviceError;
|
||||||
|
|
||||||
#ifdef VIDEO
|
#ifdef VIDEO
|
||||||
VideoDeviceError init_video_devices(ToxAv* av);
|
VideoDeviceError init_video_devices(ToxAV* av);
|
||||||
#else
|
#else
|
||||||
VideoDeviceError init_video_devices();
|
VideoDeviceError init_video_devices();
|
||||||
#endif /* VIDEO */
|
#endif /* VIDEO */
|
||||||
|
@ -133,21 +133,19 @@ struct ToxWindow {
|
|||||||
|
|
||||||
#ifdef AUDIO
|
#ifdef AUDIO
|
||||||
|
|
||||||
void(*onInvite)(ToxWindow *, ToxAv *, int);
|
void(*onInvite)(ToxWindow *, ToxAV *, uint32_t, int);
|
||||||
void(*onRinging)(ToxWindow *, ToxAv *, int);
|
void(*onRinging)(ToxWindow *, ToxAV *, uint32_t, int);
|
||||||
void(*onStarting)(ToxWindow *, ToxAv *, int);
|
void(*onStarting)(ToxWindow *, ToxAV *, uint32_t, int);
|
||||||
void(*onEnding)(ToxWindow *, ToxAv *, int);
|
void(*onEnding)(ToxWindow *, ToxAV *, uint32_t, int);
|
||||||
void(*onError)(ToxWindow *, ToxAv *, int);
|
void(*onError)(ToxWindow *, ToxAV *, uint32_t, int);
|
||||||
void(*onStart)(ToxWindow *, ToxAv *, int);
|
void(*onStart)(ToxWindow *, ToxAV *, uint32_t, int);
|
||||||
void(*onCancel)(ToxWindow *, ToxAv *, int);
|
void(*onCancel)(ToxWindow *, ToxAV *, uint32_t, int);
|
||||||
void(*onReject)(ToxWindow *, ToxAv *, int);
|
void(*onReject)(ToxWindow *, ToxAV *, uint32_t, int);
|
||||||
void(*onEnd)(ToxWindow *, ToxAv *, int);
|
void(*onEnd)(ToxWindow *, ToxAV *, uint32_t, int);
|
||||||
void(*onRequestTimeout)(ToxWindow *, ToxAv *, int);
|
void(*onRequestTimeout)(ToxWindow *, ToxAV *, uint32_t, int);
|
||||||
void(*onPeerTimeout)(ToxWindow *, ToxAv *, int);
|
void(*onPeerTimeout)(ToxWindow *, ToxAV *, uint32_t, int);
|
||||||
void(*onWriteDevice)(ToxWindow *, Tox *, int, int, const int16_t *, unsigned int, uint8_t, unsigned int);
|
void(*onWriteDevice)(ToxWindow *, Tox *, uint32_t, int, const int16_t *, unsigned int, uint8_t, unsigned int);
|
||||||
|
|
||||||
int call_idx; /* If in a call will have this index set, otherwise it's -1.
|
|
||||||
* Don't modify outside av callbacks. */
|
|
||||||
int device_selection[2]; /* -1 if not set, if set uses these selections instead of primary device */
|
int device_selection[2]; /* -1 if not set, if set uses these selections instead of primary device */
|
||||||
|
|
||||||
int ringing_sound;
|
int ringing_sound;
|
||||||
@ -156,7 +154,7 @@ struct ToxWindow {
|
|||||||
int active_box; /* For box notify */
|
int active_box; /* For box notify */
|
||||||
|
|
||||||
char name[TOXIC_MAX_NAME_LENGTH + 1];
|
char name[TOXIC_MAX_NAME_LENGTH + 1];
|
||||||
uint32_t num; /* corresponds to friendnumber in chat windows */
|
int num; /* corresponds to friendnumber in chat windows */
|
||||||
bool active;
|
bool active;
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user