summaryrefslogtreecommitdiffstats
path: root/media/base/audio_discard_helper.cc
Commit message (Collapse)AuthorAgeFilesLines
* Remove implicit conversions from scoped_refptr to T* in media/dcheng2014-08-271-1/+1
| | | | | | | | | | | This patch was generated by running the rewrite_scoped_refptr clang tool on a Linux build. BUG=110610 Review URL: https://codereview.chromium.org/506683002 Cr-Commit-Position: refs/heads/master@{#292082}
* Add support for partial append window end trimming.dalecurtis@chromium.org2014-08-021-10/+53
| | | | | | | | | | | | | | Facilitates gapless playback across mp3 and aac. Relying on splice frames and crossfading doesn't work in cases where the prior segment signal diverges to null-padding values too quickly relative to the newly appended segment. BUG=395899 TEST=new unittests. llama-demo works. Review URL: https://codereview.chromium.org/414603002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287174 0039d316-1c4b-4281-b951-d872f2087c98
* Add support for complete buffer discards.dalecurtis@google.com2014-05-211-2/+16
| | | | | | | | | | | | | | | | Per discussion, allows kInfiniteDuration() for the front DiscardPadding value. When there's no decoder delay, this ensures accuracy when discarding. If decoder delay is present, the code falls back to using the duration as an estimation. BUG=371633 TEST=new unittests NOTRY=true R=wolenetz@chromium.org Review URL: https://codereview.chromium.org/293053005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271928 0039d316-1c4b-4281-b951-d872f2087c98
* Support start trimming post-decoding. Use it with FFmpegDemuxer.dalecurtis@chromium.org2014-05-031-13/+86
| | | | | | | | | | | | | | | | | | | | | | | | | FFmpeg has packet side data indicating how many frames should be trimmed after decoding, we should use it to improve playback of mp3 and aac audio via <audio> tag. Specifically: - AudioBuffer:TrimRange(start,end) is now supported. - DecoderBuffer:discard_padding() is now a pair of (front, back) which indicates how much to trim off the front and rear of the data corresponding to the encoded buffer. - AudioDiscardHelper has been updated to implement this trimming. - FFmpegDemuxer inserts FFmpeg's skip_samples into DecoderBuffer. This change paves the way for MediaSource to use this feature to implement gapless playback support. BUG=360961 TEST=new unittests! NOTRY=true Review URL: https://codereview.chromium.org/251893002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268002 0039d316-1c4b-4281-b951-d872f2087c98
* Remove AudioBuffer::set_duration(), instead base on frames.dalecurtis@chromium.org2014-05-021-3/+1
| | | | | | | | | | | | | | | | | | | | | wolenetz@ asked on https://codereview.chromium.org/251893002/ why we allow set_duration() to be called. It used to be required since AudioBuffers had no concept of sample rate. However, we now attach a sample rate to every AudioBuffer which allows us to enforce a valid duration for every buffer. This CL also aligns MakeAudioBuffer() to do the same thing with planar and interleaved data for the sake of easier testing. BUG=none TEST=media_unittests NOTRY=true Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=267779 Review URL: https://codereview.chromium.org/261533002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267842 0039d316-1c4b-4281-b951-d872f2087c98
* Revert of Remove AudioBuffer::set_duration(), instead base on frames. ↵falken@chromium.org2014-05-021-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (https://codereview.chromium.org/261533002/) Reason for revert: This seems to have broken the chromium.webkit WebKit Win x64 Builder bot. Log: http://build.chromium.org/p/chromium.webkit/builders/WebKit%20Win%20x64%20Builder/builds/6453 Snippet from log: c:\b\build\slave\webkit-win-latest-rel-x64\build\src\media\base\audio_buffer.cc(16) : error C2220: warning treated as error - no 'object' file generated c:\b\build\slave\webkit-win-latest-rel-x64\build\src\media\base\audio_buffer.cc(16) : warning C4723: potential divide by 0 Original issue's description: > Remove AudioBuffer::set_duration(), instead base on frames. > > wolenetz@ asked on https://codereview.chromium.org/251893002/ why > we allow set_duration() to be called. It used to be required since > AudioBuffers had no concept of sample rate. However, we now attach > a sample rate to every AudioBuffer which allows us to enforce a > valid duration for every buffer. > > This CL also aligns MakeAudioBuffer() to do the same thing with > planar and interleaved data for the sake of easier testing. > > BUG=none > TEST=media_unittests > NOTRY=true > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=267779 TBR=jrummell@chromium.org,dmichael@chromium.org,dalecurtis@chromium.org NOTREECHECKS=true NOTRY=true BUG=none Review URL: https://codereview.chromium.org/265943002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267788 0039d316-1c4b-4281-b951-d872f2087c98
* Remove AudioBuffer::set_duration(), instead base on frames.dalecurtis@chromium.org2014-05-021-3/+1
| | | | | | | | | | | | | | | | | | | wolenetz@ asked on https://codereview.chromium.org/251893002/ why we allow set_duration() to be called. It used to be required since AudioBuffers had no concept of sample rate. However, we now attach a sample rate to every AudioBuffer which allows us to enforce a valid duration for every buffer. This CL also aligns MakeAudioBuffer() to do the same thing with planar and interleaved data for the sake of easier testing. BUG=none TEST=media_unittests NOTRY=true Review URL: https://codereview.chromium.org/261533002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267779 0039d316-1c4b-4281-b951-d872f2087c98
* Introduce AudioDiscardHelper. Refactor audio decoders to use it.dalecurtis@chromium.org2014-04-291-0/+114
We've long had duplicated code in the opus and ffmpeg audio decoders based around discarding samples from the front of back of output buffers. This change standarizes this into a better tested helper class. This paves the way for a later change which will expand discard_padding() for use by media source. It also fixed the chained ogg case with opus by allowing non-monotonic timestamps for the opus decoder. BUG=175281, 360961 TEST=new unittest. existing tests pass. NOTRY=true Review URL: https://codereview.chromium.org/259453003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266953 0039d316-1c4b-4281-b951-d872f2087c98