Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Issue 251893002: Support start trimming post-decoding. Use it with FFmpegDemuxer. (Closed)

Created:
6 years, 8 months ago by DaleCurtis
Modified:
6 years, 7 months ago
CC:
chromium-reviews, feature-media-reviews_chromium.org
Visibility:
Public.

Description

Support start trimming post-decoding. Use it with FFmpegDemuxer. 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 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=268002

Patch Set 1 : Typo. #

Total comments: 2

Patch Set 2 : Rebase. #

Total comments: 27

Patch Set 3 : Rebase. Fix TrimRange. #

Total comments: 30

Patch Set 4 : Comments. #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+460 lines, -50 lines) Patch
M media/base/audio_buffer.h View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M media/base/audio_buffer.cc View 1 2 3 1 chunk +43 lines, -0 lines 2 comments Download
M media/base/audio_buffer_unittest.cc View 1 2 2 chunks +117 lines, -2 lines 1 comment Download
M media/base/audio_discard_helper.h View 1 2 3 2 chunks +20 lines, -2 lines 0 comments Download
M media/base/audio_discard_helper.cc View 1 2 3 6 chunks +86 lines, -13 lines 2 comments Download
M media/base/audio_discard_helper_unittest.cc View 1 2 3 10 chunks +137 lines, -13 lines 0 comments Download
M media/base/decoder_buffer.h View 3 chunks +8 lines, -3 lines 0 comments Download
M media/base/decoder_buffer.cc View 1 chunk +2 lines, -1 line 0 comments Download
M media/filters/ffmpeg_audio_decoder.cc View 1 1 chunk +2 lines, -1 line 0 comments Download
M media/filters/ffmpeg_demuxer.cc View 1 2 3 2 chunks +25 lines, -12 lines 0 comments Download
M media/filters/opus_audio_decoder.cc View 1 1 chunk +2 lines, -1 line 0 comments Download
M media/filters/pipeline_integration_test.cc View 1 chunk +11 lines, -0 lines 0 comments Download
M media/formats/webm/webm_cluster_parser.cc View 1 1 chunk +3 lines, -2 lines 2 comments Download

Messages

Total messages: 36 (0 generated)
DaleCurtis
wolenetz: Part II for review after https://codereview.chromium.org/259453003/ lands. acolwell: FYI again.
6 years, 8 months ago (2014-04-26 00:35:23 UTC) #1
wolenetz
First glance comment :) (My full review will pend the landing of the prereq CL ...
6 years, 7 months ago (2014-04-28 23:02:01 UTC) #2
DaleCurtis
https://codereview.chromium.org/251893002/diff/20001/media/base/audio_buffer_unittest.cc File media/base/audio_buffer_unittest.cc (right): https://codereview.chromium.org/251893002/diff/20001/media/base/audio_buffer_unittest.cc#newcode16 media/base/audio_buffer_unittest.cc:16: static void VerifyResult(float* channel_data, On 2014/04/28 23:02:02, wolenetz wrote: ...
6 years, 7 months ago (2014-04-28 23:11:58 UTC) #3
DaleCurtis
The baseline is off for this now a bit, i'll rebase after CQ'ing the part ...
6 years, 7 months ago (2014-04-28 23:19:19 UTC) #4
wolenetz
On 2014/04/28 23:11:58, DaleCurtis wrote: > https://codereview.chromium.org/251893002/diff/20001/media/base/audio_buffer_unittest.cc > File media/base/audio_buffer_unittest.cc (right): > > https://codereview.chromium.org/251893002/diff/20001/media/base/audio_buffer_unittest.cc#newcode16 > ...
6 years, 7 months ago (2014-04-28 23:54:31 UTC) #5
DaleCurtis
Rebased on the final version of part I.
6 years, 7 months ago (2014-04-29 00:43:34 UTC) #6
wolenetz
First round of comments: I've only reviewed audio_buffer.{cc,h} so far. https://codereview.chromium.org/251893002/diff/40001/media/base/audio_buffer.cc File media/base/audio_buffer.cc (right): https://codereview.chromium.org/251893002/diff/40001/media/base/audio_buffer.cc#newcode284 ...
6 years, 7 months ago (2014-04-29 01:18:29 UTC) #7
wolenetz
On 2014/04/29 01:18:29, wolenetz wrote: > First round of comments: I've only reviewed audio_buffer.{cc,h} so ...
6 years, 7 months ago (2014-04-29 01:21:53 UTC) #8
DaleCurtis
https://codereview.chromium.org/251893002/diff/40001/media/base/audio_buffer.cc File media/base/audio_buffer.cc (right): https://codereview.chromium.org/251893002/diff/40001/media/base/audio_buffer.cc#newcode284 media/base/audio_buffer.cc:284: const int frames_to_copy = adjusted_frame_count_ - frames_to_trim; On 2014/04/29 ...
6 years, 7 months ago (2014-04-29 03:16:19 UTC) #9
wolenetz
Review still in progress. A few more nits/comments: https://codereview.chromium.org/251893002/diff/40001/media/base/audio_buffer.cc File media/base/audio_buffer.cc (right): https://codereview.chromium.org/251893002/diff/40001/media/base/audio_buffer.cc#newcode290 media/base/audio_buffer.cc:290: memcpy(channel_data_[ch] ...
6 years, 7 months ago (2014-04-29 19:18:07 UTC) #10
DaleCurtis
https://codereview.chromium.org/251893002/diff/40001/media/base/audio_buffer_unittest.cc File media/base/audio_buffer_unittest.cc (right): https://codereview.chromium.org/251893002/diff/40001/media/base/audio_buffer_unittest.cc#newcode395 media/base/audio_buffer_unittest.cc:395: EXPECT_EQ(buffer->duration(), base::TimeDelta::FromSeconds(50)); On 2014/04/29 19:18:08, wolenetz wrote: > I ...
6 years, 7 months ago (2014-04-29 20:46:34 UTC) #11
DaleCurtis
Making acolwell a reviewer since it's unclear how long wolenetz@ might be out. PTAL. TrimRange() ...
6 years, 7 months ago (2014-04-30 22:04:04 UTC) #12
acolwell GONE FROM CHROMIUM
Here is my initial pass. Most of the comments are questions to help me understand. ...
6 years, 7 months ago (2014-05-01 01:08:33 UTC) #13
DaleCurtis
https://codereview.chromium.org/251893002/diff/100001/media/base/audio_discard_helper.cc File media/base/audio_discard_helper.cc (right): https://codereview.chromium.org/251893002/diff/100001/media/base/audio_discard_helper.cc#newcode86 media/base/audio_discard_helper.cc:86: delayed_discard_.swap(current_encoded_buffer); On 2014/05/01 01:08:34, acolwell wrote: > Why do ...
6 years, 7 months ago (2014-05-01 01:26:32 UTC) #14
DaleCurtis
I retested with the mega trimming test clip from http://crbug.com/178309 and the OPUS discarding seems ...
6 years, 7 months ago (2014-05-01 01:44:24 UTC) #15
acolwell GONE FROM CHROMIUM
Ok. In general I think I'm ok with the changes. I think most of my ...
6 years, 7 months ago (2014-05-01 17:44:25 UTC) #16
DaleCurtis
https://codereview.chromium.org/251893002/diff/100001/media/base/audio_buffer.cc File media/base/audio_buffer.cc (right): https://codereview.chromium.org/251893002/diff/100001/media/base/audio_buffer.cc#newcode259 media/base/audio_buffer.cc:259: CHECK_LE(frames_to_trim, adjusted_frame_count_);; On 2014/05/01 01:08:34, acolwell wrote: > nit: ...
6 years, 7 months ago (2014-05-01 19:21:27 UTC) #17
acolwell GONE FROM CHROMIUM
lgtm
6 years, 7 months ago (2014-05-01 21:54:09 UTC) #18
DaleCurtis
The CQ bit was checked by dalecurtis@chromium.org
6 years, 7 months ago (2014-05-02 19:40:02 UTC) #19
DaleCurtis
CQ'ing! wolenetz@ confirmed he was okay with go ahead for now, any issues found will ...
6 years, 7 months ago (2014-05-02 19:40:29 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dalecurtis@chromium.org/251893002/120001
6 years, 7 months ago (2014-05-02 19:40:34 UTC) #21
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 7 months ago (2014-05-02 20:12:11 UTC) #22
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_chromeos_rel on tryserver.chromium
6 years, 7 months ago (2014-05-02 20:12:12 UTC) #23
DaleCurtis
The CQ bit was checked by dalecurtis@chromium.org
6 years, 7 months ago (2014-05-02 20:14:45 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dalecurtis@chromium.org/251893002/120001
6 years, 7 months ago (2014-05-02 20:15:27 UTC) #25
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 7 months ago (2014-05-02 20:19:14 UTC) #26
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_rel on tryserver.chromium
6 years, 7 months ago (2014-05-02 20:19:14 UTC) #27
DaleCurtis
The CQ bit was checked by dalecurtis@chromium.org
6 years, 7 months ago (2014-05-02 21:54:18 UTC) #28
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dalecurtis@chromium.org/251893002/120001
6 years, 7 months ago (2014-05-02 21:55:07 UTC) #29
DaleCurtis
The CQ bit was unchecked by dalecurtis@chromium.org
6 years, 7 months ago (2014-05-03 01:34:01 UTC) #30
DaleCurtis
The CQ bit was checked by dalecurtis@chromium.org
6 years, 7 months ago (2014-05-03 01:35:28 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dalecurtis@chromium.org/251893002/120001
6 years, 7 months ago (2014-05-03 01:35:52 UTC) #32
commit-bot: I haz the power
Change committed as 268002
6 years, 7 months ago (2014-05-03 02:08:30 UTC) #33
wolenetz
I'm sorry for my belated CR on this. https://codereview.chromium.org/251893002/diff/120001/media/base/audio_buffer.cc File media/base/audio_buffer.cc (right): https://codereview.chromium.org/251893002/diff/120001/media/base/audio_buffer.cc#newcode275 media/base/audio_buffer.cc:275: const ...
6 years, 7 months ago (2014-05-05 19:01:23 UTC) #34
wolenetz
https://codereview.chromium.org/251893002/diff/120001/media/base/audio_buffer.cc File media/base/audio_buffer.cc (right): https://codereview.chromium.org/251893002/diff/120001/media/base/audio_buffer.cc#newcode275 media/base/audio_buffer.cc:275: const int frames_to_copy = adjusted_frame_count_ - end; On 2014/05/05 ...
6 years, 7 months ago (2014-05-05 19:03:02 UTC) #35
DaleCurtis
6 years, 7 months ago (2014-05-05 20:16:03 UTC) #36
Message was sent while issue was closed.
https://codereview.chromium.org/251893002/diff/120001/media/base/audio_discar...
File media/base/audio_discard_helper.cc (right):

https://codereview.chromium.org/251893002/diff/120001/media/base/audio_discar...
media/base/audio_discard_helper.cc:99: // For simplicity disallow cases where a
buffer with discard padding is
On 2014/05/05 19:01:23, wolenetz wrote:
> nit: how common is this? should we track it in release builds (change to
> CHECKs?)

It shouldn't be possible right now, so the DCHECK() should be sufficient.

https://codereview.chromium.org/251893002/diff/120001/media/formats/webm/webm...
File media/formats/webm/webm_cluster_parser.cc (right):

https://codereview.chromium.org/251893002/diff/120001/media/formats/webm/webm...
media/formats/webm/webm_cluster_parser.cc:421:
base::TimeDelta::FromMicroseconds(discard_padding / 1000)));
On 2014/05/05 19:01:23, wolenetz wrote:
> Matroska allows for negative DiscardPadding to indicate start discard, and
> positive for end discard.
> 
> Do any of our WebM-parsed formats possibly include negative DiscardPadding
> (start discard)? If so, account for it here. If not, add DLOG(ERROR... or
> CHECK(... ?

I didn't know that.  If WebM supports that, probably this code should be setting
start padding to -discard_padding then.  There'a a DCHECK in the
AudioDiscardHelper against negative values.

acolwell: WDYT?

Powered by Google App Engine
This is Rietveld 408576698