summaryrefslogtreecommitdiff
path: root/toxav
AgeCommit message (Collapse)Author
2018-08-13Fix groupav.c style and avoid casts in toxav_old.c.iphydf
* No anonymous structs. * No assignment expressions. * Only one declarator per struct member declaration. * Named callback types only, no inline types. * No `;` empty statements. * `++i` instead of `i++`. Avoiding a cast in toxav_old.c avoids some potential (and real) bugs.
2018-08-12Fix coding style in rtp module.iphydf
* Named callback types only. * No anonymous enums or structs. * `++i` instead of `i++`. * Don't use enums to specify integer constants. Enums should be enumerations. All values of an enum type should be listed[1]. [1] I don't know what to do about bit masks yet, but given that enums by C standard can only go up to 32767 portably and 2^31 in reality, they are probably not useful for 64 bit bit masks.
2018-08-12Fix style in msi.c.iphydf
* Don't use anonymous enums (`typedef enum { ... } Name;`). * Don't use macros to generate structs (too magical, hard to grep). * Assign output parameter once, and don't access it a lot in the function body. * Don't pass type names as parameters to macros (this is C, we don't have templates, sorry). * All function-like macros must be do-while(0). * `++i` instead of `i++`. * No assignment-expressions. * No void-casts.
2018-08-12Make `conferences_object` properly typed.iphydf
The void pointer here only adds opportunity to introduce bugs and doesn't actually make things more layered. It's just the code lying about being layered while it's actually spaghetti.
2018-08-12Fix enumerator names to comply with toxcore naming standards.iphydf
2018-08-12Avoid forward declaration of rtp structs.iphydf
Forward declarations are problematic, as they easily allow introducing cyclic dependencies.
2018-08-12Fix style in bwcontroller module.iphydf
* Comments in macros must be `//` style. * No inner structs. * Named callback types. * `++i` instead of `i++`. * No assignments as expressions.
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-22Run Clang global static analysis on Travis.iphydf
This uses a single .cc file containing almost all the code in the repository to perform whole program analysis.
2018-07-21Remove redundant casts to the same type.iphydf
Also removed an unused identifier in messenger_test.c.
2018-07-21Add github usernames to TODOs.iphydf
2018-07-21Synchronise parameter names in headers with those in the implementation.iphydf
2018-07-21Reduce nesting by doing more early returns on error.iphydf
This almost entirely avoids any else-after-return in toxcore. One case is left, and that one is more readable this way. Why no else after return: https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return Why exemptions exist: https://blog.mozilla.org/nnethercote/2009/08/31/no-else-after-return-considered-harmful/
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-07-08Avoid side-effectful assignments in conditionals.iphydf
Only in audio.c for now. This should be done everywhere.
2018-07-08Remove VLA usage from `send_audio_packet`.iphydf
Also use `net_pack_u16` in that function instead of manual ntohs+memcpy and `net_unpack_u16` in its receiving counterpart.
2018-07-07Call the "peer leaves" callback only once on group delete.iphydf
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-04Add some tests for our ring_buffer implementation.iphydf
These can serve as documentation until we write actual api docs, probably using apidsl.
2018-06-24Use clang-format for C++ code.iphydf
`clang-format -style='{BasedOnStyle: Google, ColumnLimit: 100}'`
2018-06-24Add Logger to various net_crypto functions.iphydf
In preparation for adding log statements. Also, fix an uninitialised variable warning in cppcheck.
2018-06-16Only check full rtp offset if RTP_LARGE_FRAME is setRobin Lindén
2018-05-20Move system header includes from network.h to network.ciphydf
2018-04-17Improve network error reporting on WindowsMaxim Biro
Windows doesn't report network errors though errno, it has its own facilities.
2018-03-16Remove the use of the 'hh' format specifier.iphydf
It's not supported in mingw. See https://github.com/TokTok/c-toxcore/issues/786.
2018-03-09Don't set RTP_LARGE_FRAME on rtp audio packetsRobin Lindén
2018-03-09Don't throw away rtp packets from old ToxcoreRobin Lindén
2018-02-24Fix a bunch of compiler warnings and remove suppressions.iphydf
2018-02-20make groupnumber uint32_tsudden6
fixes #606
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-02-08Remove csrc from the RTPHeader struct.iphydf
This is not used by anything in the code, so we shouldn't have it in the header.
2018-02-06Format .cpp files with format-source.iphydf
2018-02-01Manually serialise RTPHeader struct instead of memcpy.iphydf
2018-01-31Change the "capabilities" field to a "flags" field.iphydf
This is more appropriate for RTP headers. Capabilities may be negotiated up front, but flags are useful in each packet.
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-29Add RTP header fields for the full frame length and offset.iphydf
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-28Avoid clashes with "build" directories on case-insensitive file systems.iphydf
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.
2018-01-25Rename some rtp header struct members to be clearer.iphydf
These are the names used in the next PR, in RTPHeaderV3, so here we rename the old struct members already.
2018-01-22Publish a single public BUILD target for c-toxcore.iphydf
2018-01-21Make BUILD files more finely-grained.iphydf
This allows us to precisely see which libraries depend on which and lets us split them up more, if necessary.
2018-01-21Add comment from #629 in ring_buffer.c.iphydf
2018-01-21Add BUILD files for all the little tools in the repo.iphydf
Also, fix av_test.c, since I broke it last time.
2018-01-19Add some explanatory comments to the toxav audio code.iphydf
By @zoff99.
2018-01-19Use more descriptive names in bwcontroller.iphydf
2018-01-19Extract named constants from magic numbers in toxav/audio.c.iphydf
By @zoff99.
2018-01-18Use C99 standard in bazel builds.iphydf