Skip to content
Snippets Groups Projects
  1. Dec 30, 2015
    • Timothy B. Terriberry's avatar
      Fix potential memory leaks with OpusServerInfo. · 0b2fe85a
      Timothy B. Terriberry authored
      In op_[v]open_url() and op_[v]test_url(), if we successfully
       connected to the URL but fail to parse it as an Opus stream, then
       we would return to the calling application without clearing any
       OpusServerInfo we might have filled in when connecting.
      This contradicts the general contract for user output buffers in
       our APIs, which is that they do not need to be initialized prior
       to a call and that their contents are untouched if a function
       fails (so that an application need do no additional clean-up on
       error).
      It would have been possible for an application to avoid these leaks
       by always calling opus_server_info_init() before a call to
       op_[v]open_url() or op_[v]test_url() and always calling
       opus_server_info_clear() afterwards (even on failure), but our
       examples don't do this and no other API of ours requires it.
      
      Fix the potential leaks by wrapping the implementation of
       op_url_stream_vcreate() so we can a) tell if the information was
       requested and b) store it in a separate, local buffer and delay
       copying it to the application until we know we've succeeded.
      0b2fe85a
    • Timothy B. Terriberry's avatar
      Add API to access and preserve binary metadata. · 0221ca95
      Timothy B. Terriberry authored
      This adds support for accessing any binary metadata at the end of
       the comment header, as first specified in
       <https://tools.ietf.org/html/draft-ietf-codec-oggopus-05>.
      It also allows the data to be set and preserves the data when
       doing deep copies.
      0221ca95
  2. Dec 29, 2015
  3. Dec 15, 2015
    • Timothy B. Terriberry's avatar
      Buffer continued packet data to reduce seeking. · 661459b4
      Timothy B. Terriberry authored
      In commit 41c29626 I claimed that it was not worth the
       machinery to buffer an extra page to avoid a seek when we have
       continued packet data.
      That was a little unsatisfying, considering how much effort we make
       to avoid unnecessary seeking elsewhere, but in the general case,
       we might have to buffer an arbitrary number of pages, since a
       packet can span several.
      However, we already have the mechanism to do this buffering: the
       ogg_stream_state.
      There are a number of potentially nasty corner-cases, but libogg's
       page sequence number tracking prevents us from accidentally gluing
       extraneous packet data onto some other unsuspecting packet, so I
       believe the chance of introducing new bugs here is manageable.
      
      This reduces the number of seeks in Simon Jackson's continued-page
       test case by over 23%.
      
      This also means we can handle pages without useful timestamps
       (including those multiplexed from another stream) between the last
       timestamped page at or before our target and the first timestamped
       page after our target without any additional seeks.
      Previously we would scan all of this data, see that the
       'page_offset' of the most recent page we read was way beyond
       'best' (the end of the last timestamped page before our target),
       and then seek back and scan it all again.
      This should greatly reduce the number of seeks we need in
       multiplexed streams, even if there are no continued packets.
      661459b4
    • Timothy B. Terriberry's avatar
      Fix timestamp check for seek-free seek. · 33d17971
      Timothy B. Terriberry authored
      We avoid seeking when the seek target lies within the packets
       buffered from the current page.
      However, the calculation of the page start time was _adding_ the
       first packet's duration to its end time, instead of subtracting
       it.
      33d17971
  4. Dec 07, 2015
  5. Dec 06, 2015
    • Timothy B. Terriberry's avatar
      Handle continued packets in bisection search. · 41c29626
      Timothy B. Terriberry authored
      If the packet where we wanted to start decoding was continued from
       a previous page, and _other_ packets ended on that previous page,
       we wouldn't feed the previous page to the ogg_stream_state.
      That meant we wouldn't get the packet we wanted, and would fail with
       OP_EBADLINK (because the starting PCM offset of the first packet we
       did decode would already be after the one we wanted).
      
      Instead, check for continued packet data and feed in an extra page
       to prime the stream state.
      
      Thanks to Simon Jackson for the report and the excellent test case.
      41c29626
    • Timothy B. Terriberry's avatar
  6. Feb 27, 2015
  7. Mar 26, 2014
    • Timothy B. Terriberry's avatar
      Minor cleanups. · 6f482ef4
      Timothy B. Terriberry authored
      Makes style slightly more consistent.
      Also fixes the return code of op_fetch_headers() to make it
       consistently return OP_EBADHEADER if the stream runs out of pages
       after a valid OpusHead packet is found.
      Previously, if a valid OpusHead was found, it would return
       OP_ENOTFORMAT if it ran out of pages before finding one without
       its BOS flag set, and OP_EBADHEADER if it ran out of pages after
       finding one without its BOS flag set.
      6f482ef4
  8. Mar 25, 2014
  9. Mar 16, 2014
  10. Mar 12, 2014
  11. Mar 03, 2014
  12. Jan 11, 2014
  13. Jan 08, 2014
  14. Nov 20, 2013
  15. Sep 03, 2013
    • Timothy B. Terriberry's avatar
      Fix a parentheses error in op_utf8_to_utf16(). · 779ea4da
      Timothy B. Terriberry authored
      For many Latin1 characters this still worked correctly by pure luck.
      Unfortunately, that included my test case.
      779ea4da
    • Timothy B. Terriberry's avatar
      Fix a granpos calculation we assumed couldn't fail. · d6697905
      Timothy B. Terriberry authored
      It was only guaranteed to work in the seekable case.
      Thanks to Radio Stadtfilter 96.3Mhz for sending a stream which
       triggered this failure.
      d6697905
    • Timothy B. Terriberry's avatar
      %s/op_read_native_filter/op_filter_read_native/g · 2ab13b78
      Timothy B. Terriberry authored
      All the actual filters are named op_foo_filter(), so
       op_read_native_filter() looked like another one.
      Changing the word order should remove the ambiguity.
      2ab13b78
    • Timothy B. Terriberry's avatar
      Mark more internal pointers const. · e6e2b83b
      Timothy B. Terriberry authored
      Don't know if this actually leads to any better code generation,
       but it may make the code a little clearer.
      e6e2b83b
    • Timothy B. Terriberry's avatar
      Mark a bunch of API functions const. · 23c8a83d
      Timothy B. Terriberry authored
      This makes it clear they don't modify the state, which is a useful
       indicator of what is safe to call from the application decode
       callback.
      23c8a83d
    • Timothy B. Terriberry's avatar
      Minor simplification to end-trimming logic. · 4d75f855
      Timothy B. Terriberry authored
      This is a little easier to read, and allows us to save some
       subtractions and a comparison.
      4d75f855
    • Timothy B. Terriberry's avatar
      Get rid of the op_float2short_filter() wrapper. · 80751579
      Timothy B. Terriberry authored
      The increasingly-inaccurately named op_shaped_dither16() can serve
       this role instead, without much additional complexity (perhaps
       less, once you consider the required shuffling around of the
       function parameters).
      80751579
    • Timothy B. Terriberry's avatar
      Add an API to disable dithering. · 8396a1f8
      Timothy B. Terriberry authored
      This is to correspond to the feature in opus-tools's opusdec.
      opusdec itself probably won't be able to use it, because it still
       wants to do dithering after resampling, but the motivation for the
       feature is the same.
      8396a1f8
    • Timothy B. Terriberry's avatar
      Avoid clipping in short->float stereo downmixing. · a88a90f9
      Timothy B. Terriberry authored
      Previously I'd said this would require a large stack buffer, which
       was true if you simply wanted to re-use the existing
       op_short2float_filter() and floating-point op_stereo_filter().
      But the latter is not normally compiled for fixed-point anyway, so
       we can instead write new code that doesn't need the stack buffer
       without harming anything.
      a88a90f9
    • Timothy B. Terriberry's avatar
      Remove some OP_UNLIKELY macros. · 49233ebf
      Timothy B. Terriberry authored
      These were unlikely when I originally expected applications to
       normally provide a decode buffer in the right format of sufficient
       size.
      However, the decode filter API works by asking to decode into a
       0-byte buffer, which will trigger both of these tests on every
       packet.
      Since this is how three of the four decoding APIs are implemented,
       this is not really that unlikely anymore.
      49233ebf
    • Timothy B. Terriberry's avatar
      Minor decode control flow updates. · e0ab29d4
      Timothy B. Terriberry authored
      This makes op_fetch_and_process_page() always try to fetch another
       page, like it used to (and like its name implies).
      There was only one place where we needed the early return for
       unprocessed packets, and getting rid of that actually simplifies
       the logic there (replacing a conditional continue with an
       unconditional one in a slightly different location).
      e0ab29d4
    • Timothy B. Terriberry's avatar
      Add an application decoding callback API. · 1b114a82
      Timothy B. Terriberry authored
      This is needed to allow advanced usage, like that of opusdec in
       opus-tools, which can simulate packet loss or save the range coder
       state for decoder verification.
      It could also be used in a pinch to use libopusfile for access to
       the raw Ogg packets, though this is somewhat of a hack.
      1b114a82
  16. Aug 25, 2013
  17. Aug 24, 2013
    • Timothy B. Terriberry's avatar
      Expose tag comparison functions. · 046b089d
      Timothy B. Terriberry authored
      It seems somewhat silly to have to write your own strcasecmp to
       satisfy the usage pattern found in opusfile_example: scanning the
       whole tags list and handling certain tags specially (as opposed to
       searching for specific tags, as opus_tags_query() does).
      Given that we were already using an equivalent function internally
       to implement opus_tags_query, just expose it directly.
      046b089d
    • Timothy B. Terriberry's avatar
      Replace 0x7FFFFFFF by new OP_INT32_MAX. · 0e4b81e1
      Timothy B. Terriberry authored
      OP_INT32_MIN and OP_INT32_MAX were added in commit 97917914.
      This fixes at least one bug, since one of the (extremely unlikely)
       overflow checks had an extra F in it.
      0e4b81e1
  18. Aug 23, 2013
    • Timothy B. Terriberry's avatar
      Add API to report information from server headers. · 97917914
      Timothy B. Terriberry authored
      This allows the application to report details about the server for
       HTTP[S] streams.
      For all HTTP[S], this includes the server software, content-type,
       and whether or not it's using HTTPS.
      For live streams, it also includes the station name, description,
       genre, homepage, nominal bitrate, and whether or not it's publicly
       listed.
      97917914
    • Timothy B. Terriberry's avatar
      Fix backwards HTTP Server header test. · f310b9ef
      Timothy B. Terriberry authored
      This was treating every unknown header as a Server header.
      Good thing this was last!
      The only damage was that we might have enabled pipelining even on
       known-bad servers.
      f310b9ef
  19. Aug 21, 2013
  20. Aug 12, 2013
    • Timothy B. Terriberry's avatar
      Fix an uninitialized variable. · 8f26e5a1
      Timothy B. Terriberry authored
      Surprisingly, the actual initial value of this variable is
       irrelevant, since we always insert 24 bits of data into and then
       read only those bits out.
      However, fixing this still removes undefined behavior and removes
       extraneous register dependencies.
      8f26e5a1
    • Timothy B. Terriberry's avatar
      Minor UTF-8/UTF-16 cleanups. · cfa59561
      Timothy B. Terriberry authored
      - Reject 'not a character' values 0xFFFE and 0xFFFF.
      - Remove some unnecessary string length checks.
      cfa59561
Loading