Index: media/base/test_helpers.h |
diff --git a/media/base/test_helpers.h b/media/base/test_helpers.h |
index bc505d43a604f4368f2a29fe385f7eb2a0d4cc04..7eebfd9fb0232fed0c993f326fb242cffc9ba02c 100644 |
--- a/media/base/test_helpers.h |
+++ b/media/base/test_helpers.h |
@@ -8,16 +8,20 @@ |
#include "base/basictypes.h" |
#include "base/callback.h" |
#include "media/base/pipeline_status.h" |
+#include "media/base/sample_format.h" |
#include "media/base/video_decoder_config.h" |
#include "testing/gmock/include/gmock/gmock.h" |
#include "ui/gfx/size.h" |
namespace base { |
class MessageLoop; |
+class TimeDelta; |
} |
namespace media { |
+class AudioBuffer; |
+ |
// Return a callback that expects to be run once. |
base::Closure NewExpectedClosure(); |
PipelineStatusCB NewExpectedStatusCB(PipelineStatus status); |
@@ -79,6 +83,51 @@ class TestVideoConfig { |
DISALLOW_IMPLICIT_CONSTRUCTORS(TestVideoConfig); |
}; |
+// Create an AudioBuffer containing |frames| frames of data, where each sample |
+// is of type T. Each frame will have the data from |channels| channels |
+// interleaved. |start| and |increment| are used to specify the values for the |
+// samples. Since this is interleaved data, channel 0 data will be: |
+// |start| |
+// |start| + |channels| * |increment| |
+// |start| + 2 * |channels| * |increment|, and so on. |
+// Data for subsequent channels is similar. No check is done that |format| |
+// requires data to be of type T, but it is verified that |format| is an |
+// interleaved format. |
+// |
+// |start_time| will be used as the start time for the samples. Duration is set |
+// to 1 second per frame, to simplify calculations. |
+template <class T> |
+scoped_refptr<AudioBuffer> MakeInterleavedAudioBuffer( |
+ SampleFormat format, |
+ int channels, |
+ T start, |
+ T increment, |
+ int frames, |
+ base::TimeDelta start_time); |
+ |
+// Create an AudioBuffer containing |frames| frames of data, where each sample |
+// is of type T. Since this is planar data, there will be a block for each of |
+// |channel| channels. |start| and |increment| are used to specify the values |
+// for the samples, which are created in channel order. Since this is planar |
+// data, channel 0 data will be: |
+// |start| |
+// |start| + |increment| |
+// |start| + 2 * |increment|, and so on. |
+// Data for channel 1 will follow where channel 0 ends. Subsequent channels are |
+// similar. No check is done that |format| requires data to be of type T, but it |
+// is verified that |format| is a planar format. |
+// |
+// |start_time| will be used as the start time for the samples. Duration is set |
+// to 1 second per frame, to simplify calculations. |
+template <class T> |
+scoped_refptr<AudioBuffer> MakePlanarAudioBuffer( |
+ SampleFormat format, |
+ int channels, |
+ T start, |
+ T increment, |
+ int frames, |
+ base::TimeDelta start_time); |
+ |
} // namespace media |
#endif // MEDIA_BASE_TEST_HELPERS_H_ |