Chromium Code Reviews| Index: media/base/audio_buffer.h |
| diff --git a/media/base/audio_buffer.h b/media/base/audio_buffer.h |
| index e97e2c23fd1e129db527fea552708382cc32a3b8..c67862cfdd834f85450b86be652f90d055851c3b 100644 |
| --- a/media/base/audio_buffer.h |
| +++ b/media/base/audio_buffer.h |
| @@ -64,6 +64,20 @@ class MEDIA_EXPORT AudioBuffer |
| const base::TimeDelta timestamp, |
| scoped_refptr<AudioBufferMemoryPool> pool = nullptr); |
| + // Create an AudioBuffer for compressed bitstream. Its channel data is copied |
| + // from |data|, and the size is |data_size|. |data| must not be null and |
| + // |frame_count| must be >= 0. |
| + static scoped_refptr<AudioBuffer> CopyBitstreamFrom( |
| + SampleFormat sample_format, |
| + ChannelLayout channel_layout, |
| + int channel_count, |
| + int sample_rate, |
| + int frame_count, |
| + const uint8_t* const* data, |
| + const size_t data_size, |
| + const base::TimeDelta timestamp, |
| + scoped_refptr<AudioBufferMemoryPool> pool = nullptr); |
| + |
| // Create an AudioBuffer with |frame_count| frames. Buffer is allocated, but |
| // not initialized. Timestamp and duration are set to kNoTimestamp. For |
| // optimal efficiency when many buffers are being created, a |
| @@ -76,6 +90,17 @@ class MEDIA_EXPORT AudioBuffer |
| int frame_count, |
| scoped_refptr<AudioBufferMemoryPool> pool = nullptr); |
| + // Create an AudioBuffer for compressed bitstream. Buffer is allocated, but |
| + // not initialized. Timestamp and duration are set to kNoTimestamp. |
| + static scoped_refptr<AudioBuffer> CreateBitstreamBuffer( |
| + SampleFormat sample_format, |
| + ChannelLayout channel_layout, |
| + int channel_count, |
| + int sample_rate, |
| + int frame_count, |
| + size_t data_size, |
| + scoped_refptr<AudioBufferMemoryPool> pool = nullptr); |
| + |
| // Create an empty AudioBuffer with |frame_count| frames. |
| static scoped_refptr<AudioBuffer> CreateEmptyBuffer( |
| ChannelLayout channel_layout, |
| @@ -128,6 +153,9 @@ class MEDIA_EXPORT AudioBuffer |
| // Return the sample rate. |
| int sample_rate() const { return sample_rate_; } |
| + // Return the sample format. |
|
DaleCurtis
2017/05/04 19:05:44
Can we drop this? And instead return IsBitstreamFo
AndyWu
2017/05/06 01:46:48
Done, you are right, IsBitstreamFormat() is enough
|
| + SampleFormat sample_format() const { return sample_format_; } |
| + |
| // Return the channel layout. |
| ChannelLayout channel_layout() const { return channel_layout_; } |
| @@ -168,6 +196,7 @@ class MEDIA_EXPORT AudioBuffer |
| int frame_count, |
| bool create_buffer, |
| const uint8_t* const* data, |
| + const size_t data_size, |
| const base::TimeDelta timestamp, |
| scoped_refptr<AudioBufferMemoryPool> pool); |