summaryrefslogtreecommitdiffstats
path: root/media/base/data_buffer.h
diff options
context:
space:
mode:
authordalecurtis@google.com <dalecurtis@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-31 20:35:25 +0000
committerdalecurtis@google.com <dalecurtis@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-31 20:35:25 +0000
commitf42d6a10c8645a83220341ef9cfd22b36b3b49b5 (patch)
treedb76016f0b892d43961d1ead916de9f79534fa62 /media/base/data_buffer.h
parent665e4fbc3d7de70829f6db36a955f63f9c4d7f9f (diff)
downloadchromium_src-f42d6a10c8645a83220341ef9cfd22b36b3b49b5.zip
chromium_src-f42d6a10c8645a83220341ef9cfd22b36b3b49b5.tar.gz
chromium_src-f42d6a10c8645a83220341ef9cfd22b36b3b49b5.tar.bz2
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. Review URL: https://chromiumcodereview.appspot.com/10447035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139857 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/data_buffer.h')
-rw-r--r--media/base/data_buffer.h8
1 files changed, 2 insertions, 6 deletions
diff --git a/media/base/data_buffer.h b/media/base/data_buffer.h
index 136bb85..af05e81 100644
--- a/media/base/data_buffer.h
+++ b/media/base/data_buffer.h
@@ -30,7 +30,6 @@ class MEDIA_EXPORT DataBuffer : public Buffer {
// Buffer implementation.
virtual const uint8* GetData() const OVERRIDE;
virtual int GetDataSize() const OVERRIDE;
- virtual const DecryptConfig* GetDecryptConfig() const OVERRIDE;
// Returns a read-write pointer to the buffer data.
virtual uint8* GetWritableData();
@@ -42,21 +41,18 @@ class MEDIA_EXPORT DataBuffer : public Buffer {
// Returns the size of the underlying buffer.
virtual int GetBufferSize() const;
- virtual void SetDecryptConfig(scoped_ptr<DecryptConfig> decrypt_config);
-
protected:
// Copies from [data,data+size) to owned array.
DataBuffer(const uint8* data, int size);
virtual ~DataBuffer();
private:
- // Helper method to allocate |data_| with at least |buffer_size| bytes.
- void AllocateBuffer(int buffer_size);
+ // Constructor helper method for memory allocations.
+ void Initialize();
scoped_array<uint8> data_;
int buffer_size_;
int data_size_;
- scoped_ptr<DecryptConfig> decrypt_config_;
DISALLOW_COPY_AND_ASSIGN(DataBuffer);
};