1. 24 Oct, 2012 1 commit
    • Timothy B. Terriberry's avatar
      Replace return code checks with OP_ALWAYS_TRUE(). · 4b70af03
      Timothy B. Terriberry authored
      Instead of assigning the return code to a local variable and then
       using OP_ASSERT(), define a new OP_ALWAYS_TRUE() macro that still
       evaluates its argument when assertions are disabled.
      This avoids -Wunused-but-set-variable warnings from clang and
       useless scan-build reports (if scan-build is run without
       assertions enabled).
      4b70af03
  2. 23 Oct, 2012 9 commits
    • Timothy B. Terriberry's avatar
      f75d06a9
    • Ralph Giles's avatar
      Don't build the API docs if doxygen isn't available. · bc1985a1
      Ralph Giles authored
      Updates the configure check to match the one in the Opus
      repository.
      bc1985a1
    • Ralph Giles's avatar
      Set the autoconf version from git. · cfd4e2c3
      Ralph Giles authored
      AC_INIT requires that the version string passed in be 'static'
      so we can't use the output of a shell invocation. However, it
      can be computed by an m4 shell invocation. This is what autoconf
      itself does to embed its git version number in PACKAGE_VERSION.
      
      Doing this necessitates the 'echo -n' in git-version.sh. Make
      is smart enough to strip the trailing newline, but AC_INIT is
      not. We must also add -f to autoreconf. Otherwise, autogen.sh
      will only update configure when configure.ac changes, even if
      the output of git-version.sh has changed.
      
      This is still not ideal, since it runs at autogen.sh time, not
      at 'make' time, which is what we want. This seems to be a limitation
      of an upcoming automake release, which removes the old style
      with PACKAGE and VERSION set by shell variables.
      cfd4e2c3
    • Timothy B. Terriberry's avatar
      Don't discard timestamps from invalid packets. · 853393be
      Timothy B. Terriberry authored
      Instead put them on the most recent valid packet on the page.
      Also bullet-proof the offset checking to the "use the current
       position when seeking" code added in 6d61f3f1.
      The previous code relied on the file not changing out from under
       us, which we shouldn't do.
      853393be
    • Timothy B. Terriberry's avatar
      Fix an assertion failure. · 9bb7bc21
      Timothy B. Terriberry authored
      This is no longer guaranteed after the change in e7661191, so test
       for it explicitly.
      Thanks to Greg Maxwell for the test case.
      9bb7bc21
    • Timothy B. Terriberry's avatar
      One small addendum to 7c52622f. · c372a2eb
      Timothy B. Terriberry authored
      This case can basically only get hit if there's another stream
       multiplexed in with ours, but this avoids re-scanning the same
       data multiple times when it happens.
      c372a2eb
    • Timothy B. Terriberry's avatar
      Bisect from the current file position when seeking. · 6d61f3f1
      Timothy B. Terriberry authored
      In most cases, this is a minor speed-up at best, but in some it can
       be a big win.
      Also, when forcing a true bisection instead of a secant-step,
       don't add the negative bias to the result.
      This can significantly improve the worst-case.
      6d61f3f1
    • Timothy B. Terriberry's avatar
      Some http improvements. · 7b2cc5f1
      Timothy B. Terriberry authored
      - Attempt to re-use connections when we've already received enough
         data to do so immediately.
      - Make sure when seeking near the end, if the current chunk size is
         such that the _next_ chunk will be half the normal size or less,
         we just ask for the rest of the resource.
      
      With these two changes, a normal open of a single-chain Opus-only
       file requires exactly two HTTP requests.
      
      - Also use the response buffer as a dummy buffer when skipping
         data.
        This will avoid helgrind errors for multiple writes from
         different threads without locking (should someone be reading
         multiple streams from different threads).
        It's also better for SMP cache contention.
      7b2cc5f1
    • Timothy B. Terriberry's avatar
      Be more scrupulous about reading extra data. · 7c52622f
      Timothy B. Terriberry authored
      This can be quite expensive with the http backend, especially if it
       causes us to pass a chunk threshold and issue a new request.
      It also lets us error out more quickly if the underlying stream
       data changes.
      7c52622f
  3. 22 Oct, 2012 2 commits
    • Timothy B. Terriberry's avatar
      Bias the offsets in op_predict_link_start(). · 498fc0bd
      Timothy B. Terriberry authored
      We apply a positive bias when the previous bisection point was
       inside the current link, causing us to scan forward a bit instead
       of seeking to a new location.
      This knocks up to 18% off the number of seeks required to open very
       large files with lots of links.
      498fc0bd
    • Timothy B. Terriberry's avatar
      Fix a few minor nits. · 21f72850
      Timothy B. Terriberry authored
      - The DIGIT character sets shouldn't need to list "0" twice.
      - Avoid a lookup for the port number in getaddrinfo().
      - Resolve the OPUS_SET_GAIN TODO (by refusing to implement a fallback).
      - A few more minor things.
      21f72850
  4. 20 Oct, 2012 5 commits
    • Timothy B. Terriberry's avatar
      Re-do abstract stream reader API. · e2d7b266
      Timothy B. Terriberry authored
      This changes op_read_func to
      a) Take a single byte count to read instead of an "item" count
          (which the http backend couldn't properly support anyway).
      b) Use integers for buffer sizes to avoid having to worry about
          sign differences and whether size_t is larger or smaller than
          opus_int64, etc.
      c) Return an explicit error code (instead of using errno like
          fread).
         We had already eliminated the use of errno, but we did it by
          treating read errors and EOF identically in all cases.
         This was preventing us from reporting SSL truncation attacks
          from the https backend.
         The https backend now properly reports such errors.
      
      This commit also fixes a bug introduced in 9b57b0c2, where we
       accidentally started passing absolute offsets to the _boundary
       parameter of op_get_next_page() instead of relative offsets.
      We now use absolute offsets in all places, as it is the simpler
       choice.
      This matters now, because the error reported when encountering EOF
       before hitting the _boundary is no longer suppressed (but instead
       reported as OP_EBADLINK).
      
      Finally, it removes the op_page_seek() function.
      Except for the time needed to decode forward after seeking, this
       function was identical in performance to op_pcm_seek(), and Opus
       requires decoding 80 ms of data after seek anyway, so the relative
       benefit is much smaller than with Vorbis.
      A survey of open-source code using libvorbisfile showed that the
       only usages of ov_page_seek() in the wild were calling it to seek
       to the start of the stream, for which op_pcm_seek() already has a
       special case that makes it just as fast.
      
      The documentation was also updated to describe all of these chanes.
      
      This is an incompatible API change.
      e2d7b266
    • Timothy B. Terriberry's avatar
      Make the URL API more extensible. · 800be8c0
      Timothy B. Terriberry authored
      Right now we have no way to add any more parameters beyond a set of
       basic binary flags.
      This unifies op_url_stream_create() and
       op_url_stream_create_with_proxy() into a single function that
       takes a variable-length list of arguments, which can be extended
       in the future to include more options of any type.
      
      This is an incompatible API change.
      800be8c0
    • Timothy B. Terriberry's avatar
      Fix op_http_parse_connection(). · 756c4c0b
      Timothy B. Terriberry authored
      We were computing the return value correctly, but then not
       returning it.
      756c4c0b
    • Timothy B. Terriberry's avatar
      Some http robustness improvements. · f83266d9
      Timothy B. Terriberry authored
      - Increase the maximum response header buffer size up to ~32 kB.
        This also moves it into a heap-allocated buffer instead of the
         stack, as 32 kB is really too much for the stack.
      - Treat LF as CR LF when parsing headers.
        This is necessary when parsing the load-balancer response in
         front of <http://lazaradio.hu:8100/bermuda.opus>.
        The response returned by that server is invalid in lots of ways,
         but with these two changes we can read it.
      - In addition, we now peek ahead at a large chunk of data when
         reading the response instead of reading 2 to 4 bytes at a time.
        This allows a typical response to be read with two syscalls
         (one peek, one read) instead of several hundred.
      - Stop trying to read more data when the connection is closed.
      f83266d9
    • Timothy B. Terriberry's avatar
      Documentation revisions and a leak fix. · 2ffd8cb7
      Timothy B. Terriberry authored
      Thanks to Jean-Marc Valin for providing documentation feedback.
      This also changes op_tags() to allow the tags to be queried on a
       partially-open file (because they've already been read and are
       available), and fixes a leak when a partially open file is freed
       instead of being fully opened.
      2ffd8cb7
  5. 14 Oct, 2012 1 commit
    • Timothy B. Terriberry's avatar
      Fix some socket connection bugs. · bb8cb7a3
      Timothy B. Terriberry authored
      The big one was that if the connect() call failed, it would loop
       forever (thanks to some code re-factoring, the loop was no longer
       advancing to the next address as originally designed).
      bb8cb7a3
  6. 13 Oct, 2012 1 commit
    • Timothy B. Terriberry's avatar
      Remove an assert. · e88aa498
      Timothy B. Terriberry authored
      On the first request made by a connection, the value it was testing
       might be uninitialized, so we can't guarantee it'll pass.
      e88aa498
  7. 12 Oct, 2012 1 commit
    • Timothy B. Terriberry's avatar
      Major updates to the http backend. · 3d78feff
      Timothy B. Terriberry authored
      * Now supports HTTP/1.1 persistent connections with pipelining.
        This speeds up chain enumeration on large files by almost a
         factor of 2 over http, and by roughly a factor of 4 over https.
        The difference between http and https is now much smaller.
      * Add timeouts to all the socket I/O.
      * Estimate the number of available bytes to read and use it when
         making connection re-use decisions.
      * Add support for https with proxies using HTTP/1.1 CONNECT
         tunnels.
      * Fix TLS session re-use (it requires clean shutdown).
      * Various other code re-organization and minor improvements.
      3d78feff
  8. 09 Oct, 2012 2 commits
  9. 07 Oct, 2012 1 commit
  10. 02 Oct, 2012 1 commit
  11. 01 Oct, 2012 16 commits