Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_BASE_AUDIO_BUFFER_H_ | 5 #ifndef MEDIA_BASE_AUDIO_BUFFER_H_ |
| 6 #define MEDIA_BASE_AUDIO_BUFFER_H_ | 6 #define MEDIA_BASE_AUDIO_BUFFER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 // Copy frames into |dest|. |frames_to_copy| is the number of frames to copy. | 87 // Copy frames into |dest|. |frames_to_copy| is the number of frames to copy. |
| 88 // |source_frame_offset| specifies how many frames in the buffer to skip | 88 // |source_frame_offset| specifies how many frames in the buffer to skip |
| 89 // first. |dest_frame_offset| is the frame offset in |dest|. The frames are | 89 // first. |dest_frame_offset| is the frame offset in |dest|. The frames are |
| 90 // converted from their source format into planar float32 data (which is all | 90 // converted from their source format into planar float32 data (which is all |
| 91 // that AudioBus handles). | 91 // that AudioBus handles). |
| 92 void ReadFrames(int frames_to_copy, | 92 void ReadFrames(int frames_to_copy, |
| 93 int source_frame_offset, | 93 int source_frame_offset, |
| 94 int dest_frame_offset, | 94 int dest_frame_offset, |
| 95 AudioBus* dest); | 95 AudioBus* dest); |
| 96 | 96 |
| 97 // Add |silence_frames| frames of silence to the start of the buffer. Silence | 97 // Copy |frames_to_copy| frames into |dest|, |frames_to_copy| is the number of |
| 98 // padding can be removed using any of the Trim*() methods. | 98 // frames to copy. The frames are converted from their source format into |
| 99 void PadStart(int silence_frames); | 99 // interleaved int32_t. |
| 100 void ReadFramesInterleavedS32(int frames_to_copy, int32_t* dest); | |
|
jrummell
2016/09/16 23:28:00
It appears these 2 headers got added back but not
chcunningham
2016/09/20 00:45:56
Nice catch. Weird that this still compiled. Remove
| |
| 101 | |
| 102 // Copy |frames_to_copy| frames into |dest|, |frames_to_copy| is the number of | |
| 103 // frames to copy. The frames are converted from their source format into | |
| 104 // interleaved int16_t. | |
| 105 void ReadFramesInterleavedS16(int frames_to_copy, int16_t* dest); | |
| 100 | 106 |
| 101 // Trim an AudioBuffer by removing |frames_to_trim| frames from the start. | 107 // Trim an AudioBuffer by removing |frames_to_trim| frames from the start. |
| 102 // Timestamp and duration are adjusted to reflect the fewer frames. | 108 // Timestamp and duration are adjusted to reflect the fewer frames. |
| 103 // Note that repeated calls to TrimStart() may result in timestamp() and | 109 // Note that repeated calls to TrimStart() may result in timestamp() and |
| 104 // duration() being off by a few microseconds due to rounding issues. | 110 // duration() being off by a few microseconds due to rounding issues. |
| 105 void TrimStart(int frames_to_trim); | 111 void TrimStart(int frames_to_trim); |
| 106 | 112 |
| 107 // Trim an AudioBuffer by removing |frames_to_trim| frames from the end. | 113 // Trim an AudioBuffer by removing |frames_to_trim| frames from the end. |
| 108 // Duration is adjusted to reflect the fewer frames. | 114 // Duration is adjusted to reflect the fewer frames. |
| 109 void TrimEnd(int frames_to_trim); | 115 void TrimEnd(int frames_to_trim); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 ChannelLayout channel_layout, | 164 ChannelLayout channel_layout, |
| 159 int channel_count, | 165 int channel_count, |
| 160 int sample_rate, | 166 int sample_rate, |
| 161 int frame_count, | 167 int frame_count, |
| 162 bool create_buffer, | 168 bool create_buffer, |
| 163 const uint8_t* const* data, | 169 const uint8_t* const* data, |
| 164 const base::TimeDelta timestamp); | 170 const base::TimeDelta timestamp); |
| 165 | 171 |
| 166 virtual ~AudioBuffer(); | 172 virtual ~AudioBuffer(); |
| 167 | 173 |
| 168 void AllocateAndCopy(const uint8_t* const* data, | |
| 169 int frame_count, | |
| 170 int silence_frames); | |
| 171 | |
| 172 const SampleFormat sample_format_; | 174 const SampleFormat sample_format_; |
| 173 const ChannelLayout channel_layout_; | 175 const ChannelLayout channel_layout_; |
| 174 const int channel_count_; | 176 const int channel_count_; |
| 175 int sample_rate_; | 177 int sample_rate_; |
| 176 int adjusted_frame_count_; | 178 int adjusted_frame_count_; |
| 177 const bool end_of_stream_; | 179 const bool end_of_stream_; |
| 178 base::TimeDelta timestamp_; | 180 base::TimeDelta timestamp_; |
| 179 base::TimeDelta duration_; | 181 base::TimeDelta duration_; |
| 180 | 182 |
| 181 // Contiguous block of channel data. | 183 // Contiguous block of channel data. |
| 182 std::unique_ptr<uint8_t, base::AlignedFreeDeleter> data_; | 184 std::unique_ptr<uint8_t, base::AlignedFreeDeleter> data_; |
| 183 size_t data_size_; | 185 size_t data_size_; |
| 184 | 186 |
| 185 // For planar data, points to each channels data. | 187 // For planar data, points to each channels data. |
| 186 std::vector<uint8_t*> channel_data_; | 188 std::vector<uint8_t*> channel_data_; |
| 187 | 189 |
| 188 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioBuffer); | 190 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioBuffer); |
| 189 }; | 191 }; |
| 190 | 192 |
| 191 } // namespace media | 193 } // namespace media |
| 192 | 194 |
| 193 #endif // MEDIA_BASE_AUDIO_BUFFER_H_ | 195 #endif // MEDIA_BASE_AUDIO_BUFFER_H_ |
| OLD | NEW |