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

Issue 10447035: Introducing DecoderBuffer and general Buffer cleanup. (Closed)

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

Description

Introducing DecoderBuffer and general Buffer cleanup. FFmpeg expects data to be padded and aligned in a certain way. It's currently possible to do this incorrectly and introduce dangerous issues. I enforce padding and alignment by introducing a new Buffer called DecoderBuffer and forcing DemuxerStream::Read to only accept it for transfer into decoders. DecoderBuffer allocates all memory through av_malloc (which takes care of alignment) with the appropriate padding size (except for Android, which doesn't care about this). Along the way it was necessary to clean up a large smattering of code to replace usage of DataBuffer with DecoderBuffer. I've rolled in several cleanup actions as well: - Moved DecryptConfig from Buffer to DecoderBuffer. - Replaced AVPacketBuffer and av_dup_packet with a DecoderBuffer::CopyFrom. - Fixed a resultant issue with FFmpegBitStreamConverter after removing the av_dup_packet functionality. Removed some unsupported bitstream filters. - Reduce TestDataUtil::ReadTestDataFile() to a single method returning a DecoderBuffer so unit tests will always have safe buffers. - Replace new DataBuffer(0)/new DecoderBuffer(0) w/ DecoderBuffer::CreateEOSBuffer. - Remove extraneous IsEndOfStream check from FFmpegAudioDecoder. BUG=129843 TEST=media_unittests + valgrind, layout tests. Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=139857

Patch Set 1 : Buffer Bonanza! #

Total comments: 37

Patch Set 2 : Review fixes. #

Total comments: 19

Patch Set 3 : Review fixes. Rebase. #

Total comments: 10

Patch Set 4 : Review fix! #

Total comments: 17

Patch Set 5 : Fischman Fixes! #

Total comments: 4

Patch Set 6 : Followup Fischman Fixes! #

Patch Set 7 : Wonky Windows. #

Patch Set 8 : s/2011/2012/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+461 lines, -326 lines) Patch
M media/audio/win/audio_low_latency_output_win_unittest.cc View 1 2 3 4 5 6 4 chunks +6 lines, -6 lines 0 comments Download
M media/base/buffers.h View 2 chunks +0 lines, -5 lines 0 comments Download
M media/base/buffers.cc View 1 chunk +0 lines, -4 lines 0 comments Download
M media/base/buffers_unittest.cc View 1 chunk +0 lines, -5 lines 0 comments Download
M media/base/data_buffer.h View 2 chunks +2 lines, -6 lines 0 comments Download
M media/base/data_buffer.cc View 1 4 chunks +15 lines, -33 lines 0 comments Download
A media/base/decoder_buffer.h View 1 2 3 4 5 1 chunk +66 lines, -0 lines 0 comments Download
A media/base/decoder_buffer.cc View 1 2 3 4 5 1 chunk +87 lines, -0 lines 0 comments Download
A media/base/decoder_buffer_unittest.cc View 1 2 1 chunk +103 lines, -0 lines 0 comments Download
M media/base/demuxer_stream.h View 2 chunks +2 lines, -2 lines 0 comments Download
M media/base/mock_reader.h View 1 2 3 4 5 6 7 2 chunks +2 lines, -2 lines 0 comments Download
M media/base/stream_parser_buffer.h View 1 chunk +2 lines, -2 lines 0 comments Download
M media/base/stream_parser_buffer.cc View 1 chunk +1 line, -1 line 0 comments Download
M media/base/test_data_util.h View 1 chunk +4 lines, -22 lines 0 comments Download
M media/base/test_data_util.cc View 1 3 chunks +7 lines, -30 lines 0 comments Download
M media/base/video_decoder.h View 1 chunk +0 lines, -1 line 0 comments Download
M media/crypto/aes_decryptor.h View 1 2 chunks +4 lines, -3 lines 0 comments Download
M media/crypto/aes_decryptor.cc View 1 2 3 4 5 chunks +10 lines, -12 lines 0 comments Download
M media/crypto/aes_decryptor_unittest.cc View 4 chunks +8 lines, -5 lines 0 comments Download
M media/filters/chunk_demuxer.cc View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M media/filters/chunk_demuxer_unittest.cc View 1 2 7 chunks +34 lines, -38 lines 0 comments Download
M media/filters/ffmpeg_audio_decoder.h View 2 chunks +3 lines, -2 lines 0 comments Download
M media/filters/ffmpeg_audio_decoder.cc View 1 4 chunks +7 lines, -9 lines 0 comments Download
M media/filters/ffmpeg_audio_decoder_unittest.cc View 1 5 chunks +10 lines, -13 lines 0 comments Download
M media/filters/ffmpeg_demuxer.h View 1 2 3 chunks +4 lines, -3 lines 0 comments Download
M media/filters/ffmpeg_demuxer.cc View 1 2 3 4 12 chunks +30 lines, -78 lines 0 comments Download
M media/filters/ffmpeg_demuxer_unittest.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M media/filters/ffmpeg_h264_bitstream_converter.cc View 1 2 3 4 5 6 7 2 chunks +2 lines, -2 lines 0 comments Download
M media/filters/ffmpeg_video_decoder.h View 2 chunks +4 lines, -3 lines 0 comments Download
M media/filters/ffmpeg_video_decoder.cc View 1 4 chunks +7 lines, -4 lines 0 comments Download
M media/filters/ffmpeg_video_decoder_unittest.cc View 1 7 chunks +14 lines, -15 lines 0 comments Download
M media/filters/gpu_video_decoder.h View 1 3 chunks +5 lines, -3 lines 0 comments Download
M media/filters/gpu_video_decoder.cc View 4 chunks +6 lines, -3 lines 0 comments Download
M media/filters/pipeline_integration_test.cc View 1 2 3 4 5 6 7 5 chunks +9 lines, -10 lines 0 comments Download
M media/media.gyp View 2 chunks +3 lines, -0 lines 0 comments Download
M media/tools/seek_tester/seek_tester.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 26 (0 generated)
DaleCurtis
PTAL guys. Two sets of eyes would be nice. Thanks!
8 years, 7 months ago (2012-05-26 00:17:40 UTC) #1
scherkus (not reviewing)
nice! first round of comments comin' right at ya http://codereview.chromium.org/10447035/diff/7002/media/base/data_buffer.cc File media/base/data_buffer.cc (right): http://codereview.chromium.org/10447035/diff/7002/media/base/data_buffer.cc#newcode29 media/base/data_buffer.cc:29: ...
8 years, 7 months ago (2012-05-26 01:36:32 UTC) #2
Ami GONE FROM CHROMIUM
I skimmed the API changes and nothing jumped out at me. I'll wait till the ...
8 years, 7 months ago (2012-05-26 06:07:22 UTC) #3
DaleCurtis
http://codereview.chromium.org/10447035/diff/7002/media/base/data_buffer.cc File media/base/data_buffer.cc (right): http://codereview.chromium.org/10447035/diff/7002/media/base/data_buffer.cc#newcode29 media/base/data_buffer.cc:29: // If Initialize fails data_size_ == 0 and this ...
8 years, 6 months ago (2012-05-29 21:17:01 UTC) #4
scherkus (not reviewing)
few more nits http://codereview.chromium.org/10447035/diff/74/media/base/decoder_buffer.cc File media/base/decoder_buffer.cc (right): http://codereview.chromium.org/10447035/diff/74/media/base/decoder_buffer.cc#newcode62 media/base/decoder_buffer.cc:62: return make_scoped_refptr(new DecoderBuffer(-1)); hrm.. doesn't this ...
8 years, 6 months ago (2012-05-30 00:45:19 UTC) #5
DaleCurtis
http://codereview.chromium.org/10447035/diff/74/media/base/decoder_buffer.cc File media/base/decoder_buffer.cc (right): http://codereview.chromium.org/10447035/diff/74/media/base/decoder_buffer.cc#newcode62 media/base/decoder_buffer.cc:62: return make_scoped_refptr(new DecoderBuffer(-1)); On 2012/05/30 00:45:19, scherkus wrote: > ...
8 years, 6 months ago (2012-05-30 02:28:25 UTC) #6
scherkus (not reviewing)
LGTM w/ some nits and musings about the 1-arg DecodeBuffer ctor http://codereview.chromium.org/10447035/diff/6069/media/base/decoder_buffer.h File media/base/decoder_buffer.h (right): ...
8 years, 6 months ago (2012-05-30 02:48:42 UTC) #7
DaleCurtis
http://codereview.chromium.org/10447035/diff/6069/media/base/decoder_buffer.h File media/base/decoder_buffer.h (right): http://codereview.chromium.org/10447035/diff/6069/media/base/decoder_buffer.h#newcode26 media/base/decoder_buffer.h:26: explicit DecoderBuffer(int buffer_size); On 2012/05/30 02:48:42, scherkus wrote: > ...
8 years, 6 months ago (2012-05-30 03:20:11 UTC) #8
DaleCurtis
http://codereview.chromium.org/10447035/diff/6069/media/base/decoder_buffer.h File media/base/decoder_buffer.h (right): http://codereview.chromium.org/10447035/diff/6069/media/base/decoder_buffer.h#newcode26 media/base/decoder_buffer.h:26: explicit DecoderBuffer(int buffer_size); On 2012/05/30 03:20:11, DaleCurtis wrote: > ...
8 years, 6 months ago (2012-05-30 03:50:52 UTC) #9
scherkus (not reviewing)
http://codereview.chromium.org/10447035/diff/6069/media/base/decoder_buffer.h File media/base/decoder_buffer.h (right): http://codereview.chromium.org/10447035/diff/6069/media/base/decoder_buffer.h#newcode26 media/base/decoder_buffer.h:26: explicit DecoderBuffer(int buffer_size); Gah I think you're reading too ...
8 years, 6 months ago (2012-05-30 04:32:26 UTC) #10
Ami GONE FROM CHROMIUM
Basically LGTM. http://codereview.chromium.org/10447035/diff/4144/media/base/decoder_buffer.cc File media/base/decoder_buffer.cc (right): http://codereview.chromium.org/10447035/diff/4144/media/base/decoder_buffer.cc#newcode24 media/base/decoder_buffer.cc:24: buffer_size_(data == NULL ? -1 : buffer_size) ...
8 years, 6 months ago (2012-05-30 05:19:27 UTC) #11
DaleCurtis
Thanks guys! http://codereview.chromium.org/10447035/diff/4144/media/base/decoder_buffer.cc File media/base/decoder_buffer.cc (right): http://codereview.chromium.org/10447035/diff/4144/media/base/decoder_buffer.cc#newcode24 media/base/decoder_buffer.cc:24: buffer_size_(data == NULL ? -1 : buffer_size) ...
8 years, 6 months ago (2012-05-30 17:33:47 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dalecurtis@chromium.org/10447035/7012
8 years, 6 months ago (2012-05-30 17:34:11 UTC) #13
Ami GONE FROM CHROMIUM
FYI http://codereview.chromium.org/10447035/diff/7012/media/base/decoder_buffer.cc File media/base/decoder_buffer.cc (right): http://codereview.chromium.org/10447035/diff/7012/media/base/decoder_buffer.cc#newcode18 media/base/decoder_buffer.cc:18: DCHECK(buffer_size >= 0); FWIW, DCHECK_GE. http://codereview.chromium.org/10447035/diff/7012/media/base/decoder_buffer.cc#newcode26 media/base/decoder_buffer.cc:26: if ...
8 years, 6 months ago (2012-05-30 17:38:30 UTC) #14
Ami GONE FROM CHROMIUM
FYI
8 years, 6 months ago (2012-05-30 17:38:36 UTC) #15
commit-bot: I haz the power
Try job failure for 10447035-7012 (retry) on mac_rel for step "compile" (clobber build). It's a ...
8 years, 6 months ago (2012-05-30 17:49:17 UTC) #16
DaleCurtis
http://codereview.chromium.org/10447035/diff/7012/media/base/decoder_buffer.cc File media/base/decoder_buffer.cc (right): http://codereview.chromium.org/10447035/diff/7012/media/base/decoder_buffer.cc#newcode18 media/base/decoder_buffer.cc:18: DCHECK(buffer_size >= 0); On 2012/05/30 17:38:31, Ami Fischman wrote: ...
8 years, 6 months ago (2012-05-30 17:56:17 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dalecurtis@chromium.org/10447035/15044
8 years, 6 months ago (2012-05-30 17:57:33 UTC) #18
commit-bot: I haz the power
Try job failure for 10447035-15044 (retry) on win for step "compile" (clobber build). It's a ...
8 years, 6 months ago (2012-05-30 18:29:54 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dalecurtis@chromium.org/10447035/14014
8 years, 6 months ago (2012-05-30 18:46:16 UTC) #20
commit-bot: I haz the power
Try job failure for 10447035-14014 (retry) on mac_rel for step "media_unittests". It's a second try, ...
8 years, 6 months ago (2012-05-30 19:28:12 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dalecurtis@chromium.org/10447035/14014
8 years, 6 months ago (2012-05-31 01:07:33 UTC) #22
commit-bot: I haz the power
Try job failure for 10447035-14014 (retry) on linux_rel for step "browser_tests". It's a second try, ...
8 years, 6 months ago (2012-05-31 02:21:44 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dalecurtis@chromium.org/10447035/14014
8 years, 6 months ago (2012-05-31 18:22:02 UTC) #24
commit-bot: I haz the power
Try job failure for 10447035-14014 (retry) on win_rel for step "compile" (clobber build). It's a ...
8 years, 6 months ago (2012-05-31 20:18:32 UTC) #25
DaleCurtis
8 years, 6 months ago (2012-05-31 20:36:35 UTC) #26
On 2012/05/31 20:18:32, I haz the power (commit-bot) wrote:
> Try job failure for 10447035-14014 (retry) on win_rel for step "compile"
> (clobber build).
> It's a second try, previously, step "compile" failed.
>
http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win_rel&nu...

Landed manually, http://crrev.com/139857

Powered by Google App Engine
This is Rietveld 408576698