Commit graph

6 commits

Author SHA1 Message Date
Ralph Giles
fefcad3797
trivial_example: Check the return value of fread().
Silence a gcc warning by checking the return value of the fread()
call instead of the feof() guard. This prevents an infinite loop
in the case of a read error. Otherwise, when end-of-file is reached
fread() will certainly return a smaller number of elements read
than requested, so both cases are handled now.

Add a comment to clarify that we're dropping a partial frame on
purpose to keep the code simple.

Also add more braces around conditional bodies for less error-prone
style.

Signed-off-by: Mark Harris <mark.hsj@gmail.com>
2020-06-01 00:48:49 -07:00
Ralph Giles
1168a29ecd
trivial_example: open raw pcm files in binary mode.
The simple codec round-trip example file in the doc directory
opens an input and output pcm file. It was working fine on
POSIX systems, but not on Windows, which treats text files
differently.

This is confusing in a example, so it's better to add an
explicit binary flag to the fopen() calls. This does nothing
on unix-like systems, but should make the example work for
developers on Windows.

Thanks to Wavesonics who reported this on irc.

Signed-off-by: Mark Harris <mark.hsj@gmail.com>
2020-06-01 00:48:45 -07:00
Mark Harris
58dbcf23f3 Update URLs 2016-07-06 14:17:51 -07:00
Mark Harris
50d6701e2a trivial_example: Fix error message
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2015-10-07 09:23:33 -04:00
Jean-Marc Valin
21b131fbe5 Applies padding to all CBR packets, including PLC and CELT silence 2013-11-21 14:42:00 -05:00
Jean-Marc Valin
574247f79c Adds a simple example of Opus encoding+decoding 2013-11-21 14:33:42 -05:00