summaryrefslogtreecommitdiff
path: root/toxav/toxav.c
AgeCommit message (Collapse)Author
2020-05-03Fix a bug in savedata loading when malloc fails.iphydf
Also added a bunch of asserts to tests where they don't check allocs.
2020-04-09Use public API for sending in RTP.zoff99
2020-04-08Use public API for sending in BWC.zoff99
2020-04-07Remove newlines from the end of LOGGER format strings.iphydf
See https://github.com/TokTok/hs-tokstyle/pull/49 for the corresponding tokstyle analysis.
2020-04-07Change ToxAVCall struct mutex to a more distinct name.zoff99
2020-04-07Create own instance of MonoTime for ToxAV.zoff99
2020-04-05Stop using Messenger's mono_time in bandwidth controller.zoff99
We're actually still using it, but we got a private pointer now, preparing us for having a private mono_time in toxav.
2020-03-18Make function defns match their decls regarding storage class.iphydf
We want functions declared as `static` to also be defined as `static`.
2020-03-18Mark file-local function definitions as `static`.iphydf
https://github.com/TokTok/hs-tokstyle/pull/43 implements a validation for this. We should avoid locally declaring functions from another translation unit, and instead use header files to export/import them.
2020-03-14Avoid casting back and forth between void-ptr.iphydf
In windows network code, we implement inet_pton and inet_ntop, which take void pointers. We can do slightly better because we already know the type when we call these functions, so we can avoid casting between void pointer and the addr struct types.
2020-03-14Standardise on having a comma at the end of enums.iphydf
Most of our enums already have one. Some didn't. Tokstyle is going to require commas at the end of enumerator lists in enum definitions.
2020-03-14Use spdx license identifier instead of GPL blurb.iphydf
2019-11-21fix missing mutexsudden6
2019-11-21fix ToxAV mutex released to earlysudden6
2018-09-21Fix using uninitialized mutex on call end.Mick Sayson
2018-09-19Fix typosyangfl
2018-08-26Update copyright to 2018.iphydf
2018-08-19make Mono_Time an argument to current_time_monotoniczugz (tox)
2018-08-14Fix style in toxav.c.iphydf
* Use Camel_Snake_Case for type names. * Use at least 4 characters for constant names. I.e. `END` is a type name, but `RETURN` is a constant name. This is because `DHT` is a type name (yay consistency). * Using `min_*` functions instead of MIN, we can avoid a cast. * Use `for`-loops for for-each-frame semantics instead of `while`. * Don't use assignments as expressions. * `++i` instead of `i++`. * Function pointers are dereferenced automatically, so no need to manually do so. * Avoid void pointers that lie about not being spaghetti code. Toxcore and toxav are both spaghetti and shouldn't pretend anything else. * Don't use empty statements (e.g. no `;;` anywhere in the code).
2018-08-13Fix ToxAv's use of `struct Tox`.iphydf
* Fix `toxav_get_tox` to return tox, not messenger. * Fix the casts from Tox* to Messenger* in toxav_old.c. * Pass Tox instead of Messenger to public group AV callbacks.
2018-08-12Fix enumerator names to comply with toxcore naming standards.iphydf
2018-08-12Remove all uses of the PAIR macro in toxav.iphydf
2018-08-12Remove last use of the `MIN` macro.iphydf
We use functions for this instead.
2018-08-04Make a separate `struct Tox` containing the Messenger.iphydf
This allows Tox to contain additional data on top of Messenger, making Messenger not necessarily the most top-level object. E.g. groups are built on Messenger and currently awkwardly void-pointered into it to pretend there is no cyclic dependency.
2018-07-21Add github usernames to TODOs.iphydf
2018-07-12Style fixes in TCP code; remove MIN and PAIR from util.h.iphydf
* Moved PAIR to toxav, where it's used (but really this should die). * Replace most MIN calls with typed `min_*` calls. Didn't replace the ones where the desired semantics are unclear. Moved the MIN macro to the one place where it's still used. * Avoid assignments in `while` loops. Instead, factored out the loop body into a separate `bool`-returning function. * Use named types for callbacks (`_cb` types). * Avoid assignments in `if` conditions. * Removed `MAKE_REALLOC` and expanded its two calls. We can't have templates in C, and this fake templating is ugly and hard to analyse and debug (it expands on a single line). * Moved epoll system include to the .c file, out of the .h file. * Avoid assignments in expressions (`a = b = c;`). * Avoid multiple declarators per struct member declaration. * Fix naming inconsistencies. * Replace `net_to_host` macro with function.
2018-07-09Factor out time keeping code into its own module: mono_time.c.iphydf
It turns out, `unix_time` is also monotonic, and is used as such, so I've renamed the new functions to `mono_time_*`. 2018-07-08: ``` 00:01 <@irungentoo> the idea used to be that the unix_time() function could go backward in time but I think I might have started using it like if it could not after I changed it so that it would never go back in time ```
2018-02-24Fix a bunch of compiler warnings and remove suppressions.iphydf
2018-02-11Improve video key frame sending.zoff99
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-01-30Use nullptr as NULL pointer constant instead of NULL or 0.iphydf
This changes only code, no string literals or comments.
2018-01-28Make audio/video bit rates "properties"xhe
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-25Split bit_rate_set(), one for audio, one for video.xhe
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.
2017-12-17Split video payload into multiple packets when >65kmannol
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-02-26Add part of platform-independent network API implementationDiadlo
socket -> net_socket htons -> net_htons htonl -> net_htonl connect -> net_connect sendto -> net_sendto_ip4 getaddrinfo -> net_getipport sa_family_t -> Family
2017-01-28Add VLA compatibility macro for C89-ish compilers.iphydf
2017-01-26Add platform-independent Socket and IP implementationDiadlo
2017-01-19Update license headers and remove redundant file name comment.iphydf
"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".
2016-12-21Use after free reported in #278 occurs because toxav_kill()mannol
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-11-20Fix NULL pointer dereference in log callsMaxim Biro
2016-09-28v0.0.0 => v0.0.1Gregory Mullen (grayhatter)
2016-09-24Make toxcore code C++ compatible.iphydf
It is still C code, so still compatible with C compilers as well. This change lets us see more clearly where implicit conversions occur by making them explicit.
2016-09-19Revert "Make ToxAV stateless"iphydf
This reverts commit 21f8db12c45bd56293262cd4abfb73cd9abec821. It is currently broken. Incoming call callbacks are not invoked, and instead the client goes offline immediately.
2016-09-17Make ToxAV statelessGregory Mullen (grayhatter)
2016-09-16Ensure that all TODOs have an owner.iphydf
In the future, all TODOs added either need a bug number (TODO(#NN)) or a person's github user name. By default, I made irungentoo the owner of all toxcore TODOs, mannol the owner of toxav TODOs, and myself the owner of API TODOs.
2016-09-13Add some astyle options to make it do more.iphydf
It now enforces a bit more formatting. In particular, padding inside parentheses is removed. I would like it to remove padding after unary operators, but there seems to be no option for that.
2016-09-13Group #include directives in 3-4 groups.iphydf
1. Current module (if C file). 2. Headers from current library. 3. Headers from other library (e.g. toxcore includes in toxav). 4. System headers.
2016-09-02Do not use `else` after `return`.iphydf
http://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code
2016-09-01Match parameter names in declarations with their definitions.iphydf
The parameter names were taken from function definitions to update the names in function declarations (prototypes).
2016-08-31Add braces to all if statements.iphydf
2016-08-27Move logging to a callback.iphydf
This removes the global logger (which by the way was deleted when the first tox was killed, so other toxes would then stop logging). Various bits of the code now carry a logger or pass it around. It's a bit less transparent now, but now there is no need to have a global logger, and clients can decide what to log and where.