summaryrefslogtreecommitdiffstats
path: root/media/base/audio_buffer.h
diff options
context:
space:
mode:
authorjrummell@chromium.org <jrummell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-16 01:31:25 +0000
committerjrummell@chromium.org <jrummell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-16 01:31:25 +0000
commit67afc63ec87612be374e5486cc03f51c1fb18eb6 (patch)
tree310cd24c11bfe2cfc6abea6ad698755f91cd4927 /media/base/audio_buffer.h
parent0275a5528dd5dde0db50f588e88bc2b200f60c21 (diff)
downloadchromium_src-67afc63ec87612be374e5486cc03f51c1fb18eb6.zip
chromium_src-67afc63ec87612be374e5486cc03f51c1fb18eb6.tar.gz
chromium_src-67afc63ec87612be374e5486cc03f51c1fb18eb6.tar.bz2
Fix to make sure FFmpeg and AudioBuffer use the same alignment.
Also adding a test to verify that FFmpeg and Chrome use the same sample size for all supported formats. BUG=272550 TEST=media_unittests all pass, played various audio files in the browser (mono, stereo, 5.1). Review URL: https://chromiumcodereview.appspot.com/22959004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217907 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/audio_buffer.h')
-rw-r--r--media/base/audio_buffer.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/media/base/audio_buffer.h b/media/base/audio_buffer.h
index e52355a..c3bcf4d 100644
--- a/media/base/audio_buffer.h
+++ b/media/base/audio_buffer.h
@@ -23,6 +23,11 @@ class AudioBus;
class MEDIA_EXPORT AudioBuffer
: public base::RefCountedThreadSafe<AudioBuffer> {
public:
+ // Alignment of each channel's data; this must match what ffmpeg expects
+ // (which may be 0, 16, or 32, depending on the processor). Selecting 32 in
+ // order to work on all processors.
+ enum { kChannelAlignment = 32 };
+
// Create an AudioBuffer whose channel data is copied from |data|. For
// interleaved data, only the first buffer is used. For planar data, the
// number of buffers must be equal to |channel_count|. |frame_count| is the
@@ -95,8 +100,8 @@ class MEDIA_EXPORT AudioBuffer
bool end_of_stream() const { return end_of_stream_; }
// Access to the raw buffer for ffmpeg to write directly to. Data for planar
- // data is grouped by channel.
- uint8* writable_data() { return data_.get(); }
+ // data is grouped by channel. There is only 1 entry for interleaved formats.
+ const std::vector<uint8*>& channel_data() const { return channel_data_; }
private:
friend class base::RefCountedThreadSafe<AudioBuffer>;