This makes some behaviorally-invariant changes to make certain code that
currently only works correctly with signed types work safely regardless of the
signedness of the types in question. This is preparation for a future change
that will convert a variety of types to size_t.
There are also some formatting changes (e.g. converting "enum hack" usage to real consts) to make it simpler to just change "int" to "size_t" in the future to change the types of those constants.
BUG=none
R=andrew@webrtc.org, juberti@webrtc.org, kwiberg@webrtc.org
TBR=ajm
Review URL: https://codereview.webrtc.org/1174813003
Cr-Commit-Position: refs/heads/master@{#9413}
Replace the BlockSize() workaround we were using previously to support
the push wrapper with the upstream request_frames interface. This
requires a bit of a trick to ensure we don't add more delay than
necessary. On the first pass we use a dummy Resample() call in order to
prime the buffer such that all later calls only require a single input
request through Run().
Notably, this brings in an optimized loop condition, improving
performance by ~2% - 3% on tested platforms and avoids a 20% performance
hit with clang. This addresses issue2041.
Only negligible changes to the PushSincResamplerTest SNR thresholds, due
to a fractional sample adjustment in output delay.
This still retains the per-instance CPU detection, as webrtc lacks a
LazyInstance helper for static initialization.
Ideally, we would adopt SetRatio() in PushSincResampler's
InitializeIfNeeded() for on-the-fly changes, but this will require a way
to update request_frames.
The diff against Chromium upstream is available here:
https://codereview.chromium.org/19470003
BUG=2041
TESTED=unit tests, voe_cmd_test in loopback running through all codecs
with 44.1 kHz and 48 kHz device formats using a stereo mic.
R=dalecurtis@chromium.org
Review URL: https://webrtc-codereview.appspot.com/1838004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@4406 4adac7df-926f-26a2-2b94-8c16560cd09d