Commit Graph

432 Commits

Author SHA1 Message Date
iphydf
c0c3098737
Avoid side-effectful assignments in conditionals.
Only in audio.c for now. This should be done everywhere.
2018-07-08 19:34:45 +00:00
iphydf
b3889f0f05
Remove VLA usage from send_audio_packet.
Also use `net_pack_u16` in that function instead of manual ntohs+memcpy
and `net_unpack_u16` in its receiving counterpart.
2018-07-08 13:59:37 +00:00
iphydf
08ff19a63b
Call the "peer leaves" callback only once on group delete.
We used to pass the actual peer numbers of peers leaving, but we no
longer know these in the PGC world, so we don't pass them anymore.
2018-07-07 16:02:00 +00:00
iphydf
3ef1f839fc
Add some tests for our ring_buffer implementation.
These can serve as documentation until we write actual api docs, probably
using apidsl.
2018-07-04 10:37:46 +00:00
iphydf
29b2dd6315
Use clang-format for C++ code.
`clang-format -style='{BasedOnStyle: Google, ColumnLimit: 100}'`
2018-06-24 20:17:53 +00:00
iphydf
8e00294b3c
Add Logger to various net_crypto functions.
In preparation for adding log statements.

Also, fix an uninitialised variable warning in cppcheck.
2018-06-24 19:17:32 +00:00
Robin Lindén
2f80e2206c
Only check full rtp offset if RTP_LARGE_FRAME is set 2018-06-16 22:50:07 +00:00
iphydf
be797d4b03
Move system header includes from network.h to network.c 2018-05-20 15:42:42 +00:00
Maxim Biro
7d399cedcf
Improve network error reporting on Windows
Windows doesn't report network errors though errno, it has its own facilities.
2018-04-17 19:07:50 -04:00
iphydf
aa05095419
Remove the use of the 'hh' format specifier.
It's not supported in mingw.

See https://github.com/TokTok/c-toxcore/issues/786.
2018-03-16 01:57:26 +00:00
Robin Lindén
5600251efe
Don't set RTP_LARGE_FRAME on rtp audio packets 2018-03-09 17:18:39 +00:00
Robin Lindén
5da8c8d5de
Don't throw away rtp packets from old Toxcore 2018-03-09 17:06:41 +00:00
iphydf
d3b286cb43
Fix a bunch of compiler warnings and remove suppressions. 2018-02-24 22:20:22 +00:00
sudden6
03b55cde1a
make groupnumber uint32_t
fixes #606
2018-02-20 20:58:54 +01:00
zoff99
721358208b
Improve video key frame sending.
This change does not include the addition of VP9. We do that in a
separate pull request.

Changes:

* fix the video bug (video frames larger than 65KBytes) by sending full
  frame length in alternate header field
* improve video frame reconstruction logic with slots
* configure video encoder and decoder to be multihtreaded
* set error resilience flags on video codec
* change encoder and decoder softdeadline
2018-02-11 23:31:46 +00:00
iphydf
36ba80aacb
Remove csrc from the RTPHeader struct.
This is not used by anything in the code, so we shouldn't have it in the
header.
2018-02-08 13:20:40 +00:00
iphydf
feaefbcbb3
Format .cpp files with format-source. 2018-02-06 13:44:03 +00:00
iphydf
83779a21ea
Manually serialise RTPHeader struct instead of memcpy. 2018-02-01 23:35:44 +00:00
iphydf
ba176f767a
Change the "capabilities" field to a "flags" field.
This is more appropriate for RTP headers. Capabilities may be negotiated
up front, but flags are useful in each packet.
2018-01-31 13:50:12 +00:00
iphydf
92ffad1a72
Use nullptr as NULL pointer constant instead of NULL or 0.
This changes only code, no string literals or comments.
2018-01-30 23:35:50 +00:00
iphydf
623e9ac331
Add RTP header fields for the full frame length and offset.
This also adds RTPCapabilities and a header field to tell the receiver
about capabilities used in encoding this frame. It is intended to contain
settings relevant to the current frame being sent.
2018-01-29 23:01:13 +00:00
iphydf
6e0ac337c9
Avoid clashes with "build" directories on case-insensitive file systems. 2018-01-28 15:17:34 +00:00
xhe
651ef3adb6
Make audio/video bit rates "properties"
follow TokTok#731. This commit
completely removed all things in namespace bit_rate, and deprecated
functions are to be added back in another commit. set_xxx() is treadted
as a property of namespace audio&video, same as bit_rate change event.

toxav_basic_test is fixed, either.
2018-01-28 13:21:57 +00:00
xhe
0becafd272
Split bit_rate_set(), one for audio, one for video.
Fixes #572.

As discussed in the issue, there's a risk that toxcore may not hold the
maximum bitrates libvpx supports, if toxcore insists on using integer
type. I initially proposed to have another flag in set(), so that we can
use unsigned type instead. iphydf came up with a better solution, that is
splitting the original functions, one for audio, one for video. Now, we
could safely replace int32_t with uint32_t.

Also: clean video_bit_rate_invalid()

Though this is not a part of issue #572, as it's used in the
toxav_bit_rate_set(), i cleaned the code. As mannol said, there should be
a check. Uint32_t is large enough to hold the maximum bitrates libvpx
supports, but user may pass a value larger than uint while smaller than
uint32_t. Thanks to the reminding from nurupo, it's no longer a stub
function.

Bitrate error enums are shared for both audio and video
https://github.com/TokTok/c-toxcore/pull/578#issuecomment-360095609, just
as iphydf said.
2018-01-25 14:29:01 +00:00
iphydf
cd8080f6d1
Rename some rtp header struct members to be clearer.
These are the names used in the next PR, in RTPHeaderV3, so here we
rename the old struct members already.
2018-01-25 09:42:01 +00:00
iphydf
42636861d8
Publish a single public BUILD target for c-toxcore. 2018-01-22 21:18:24 +00:00
iphydf
52778aed93
Make BUILD files more finely-grained.
This allows us to precisely see which libraries depend on which and lets
us split them up more, if necessary.
2018-01-21 19:44:09 +00:00
iphydf
6c98791563
Add comment from #629 in ring_buffer.c. 2018-01-21 17:42:19 +00:00
iphydf
1cecb6c87a
Add BUILD files for all the little tools in the repo.
Also, fix av_test.c, since I broke it last time.
2018-01-21 01:31:11 +00:00
iphydf
656040027d
Add some explanatory comments to the toxav audio code.
By @zoff99.
2018-01-19 22:27:04 +00:00
iphydf
1a4e56397b
Use more descriptive names in bwcontroller. 2018-01-19 21:03:48 +00:00
iphydf
f1d726a3a8
Extract named constants from magic numbers in toxav/audio.c.
By @zoff99.
2018-01-19 20:20:36 +00:00
iphydf
0a5be3cbc5
Use C99 standard in bazel builds. 2018-01-18 21:52:31 +00:00
iphydf
18a33169b8
Add bazel build scripts for c-toxcore.
This allows us and users to reproducibly build verified versions of the
library with checksums. It will power the toktok-stack continuous build
with checked-in checksums at specific git revisions.
2018-01-18 16:11:52 +00:00
iphydf
da739a9438
Add random_u16 function and rename the others to match. 2018-01-14 21:08:02 +00:00
endoffile78
f4ba43c81b
Remove useless if statement 2018-01-13 16:01:43 +00:00
iphydf
54ec162558
Fix formatting in some C files.
Also replace &(x) with &x for consistency.
2018-01-10 18:57:37 +00:00
mannol
e996a030f0
Split video payload into multiple packets when >65k
This is the implementation of the [proposed fix](https://github.com/TokTok/c-toxcore/issues/620#issuecomment-346902071) for [this issue](https://github.com/TokTok/c-toxcore/issues/620).
2017-12-17 16:31:23 +01:00
yangfl
2651193b99
Fix typo 2017-11-19 23:52:23 +01:00
iphydf
1e8fa85aad
Add a monolith_test that includes all toxcore sources.
This requires that every symbol, even if static (file-scope), is unique.
The idea is that we can easily run "whole" program static analysis on
programs that include monolith.h ("whole" is in quotes, as we don't
include dependencies like libsodium in this static analysis).
2017-06-04 17:48:23 +00:00
Diadlo
b19a9e5464
Add part of platform-independent network API implementation
socket      -> net_socket
htons       -> net_htons
htonl       -> net_htonl
connect     -> net_connect
sendto      -> net_sendto_ip4
getaddrinfo -> net_getipport
sa_family_t -> Family
2017-02-26 23:16:16 +03:00
iphydf
6ae33c16cf
Add VLA compatibility macro for C89-ish compilers. 2017-01-28 20:49:12 +00:00
Diadlo
f00006cf1d
Add platform-independent Socket and IP implementation 2017-01-26 23:11:15 +03:00
iphydf
8f96ca6d86
Update license headers and remove redundant file name comment.
"All rights reserved" was incorrect. The project was licensed under GPL3,
which means a lot of rights are licensed to everybody in the world, i.e.
not reserved to the "Tox Project".
2017-01-19 00:01:44 +00:00
Sergey 'Jin' Bostandzhyan
3f24f04876 Setup autotools to read .so version info from a separate file
We want to use the same libtool style .so versions in both build systems,
ideally both systems should read the version information from the same
configuration file.

This commit introduces an so.version configuration file and sets up
the autotools to use it.

The version numbers in so.version define the ABI compatibility and should be
updated prior to each release.

implements #323
2017-01-18 11:20:07 +01:00
mannol
7122d2e862 Use after free reported in #278 occurs because toxav_kill()
calls msi_kill() (toxav.c:180) which frees msi_call instances (msi.c:161)
which are then used when call_remove() (toxav.c:1136) is called.
This fix prevents call_remove() from calling invalid pointer.

Fixes #278
2016-12-21 00:16:22 +01:00
Gregory Mullen (grayhatter)
d66b3eabd5
rename messenger function, prepend m_ 2016-12-03 13:21:27 -08:00
Maxim Biro
551660a64a Fix a memory leak in GroupAV 2016-11-20 20:51:48 -05:00
Maxim Biro
44ac196936 Fix NULL pointer dereference in log calls 2016-11-20 20:32:48 -05:00
iphydf
3bc5ad1c13 Add NONE enumerator to bit mask. 2016-11-20 16:38:30 +00:00