Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(514)

Side by Side Diff: media/base/test_helpers.h

Issue 261533002: Remove AudioBuffer::set_duration(), instead base on frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix divide by zero case. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/base/audio_splicer_unittest.cc ('k') | media/base/test_helpers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_TEST_HELPERS_H_ 5 #ifndef MEDIA_BASE_TEST_HELPERS_H_
6 #define MEDIA_BASE_TEST_HELPERS_H_ 6 #define MEDIA_BASE_TEST_HELPERS_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "media/base/channel_layout.h" 10 #include "media/base/channel_layout.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 // Returns coded size for Normal and Large config. 80 // Returns coded size for Normal and Large config.
81 static gfx::Size NormalCodedSize(); 81 static gfx::Size NormalCodedSize();
82 static gfx::Size LargeCodedSize(); 82 static gfx::Size LargeCodedSize();
83 83
84 private: 84 private:
85 DISALLOW_IMPLICIT_CONSTRUCTORS(TestVideoConfig); 85 DISALLOW_IMPLICIT_CONSTRUCTORS(TestVideoConfig);
86 }; 86 };
87 87
88 // Create an AudioBuffer containing |frames| frames of data, where each sample 88 // Create an AudioBuffer containing |frames| frames of data, where each sample
89 // is of type T. 89 // is of type T. |start| and |increment| are used to specify the values for the
90 // samples, which are created in channel order. The value for frame and channel
91 // is determined by:
90 // 92 //
91 // For interleaved formats, each frame will have the data from |channels| 93 // |start| + |channel| * |frames| * |increment| + index * |increment|
92 // channels interleaved. |start| and |increment| are used to specify the values
93 // for the samples. Since this is interleaved data, channel 0 data will be:
94 // |start|
95 // |start| + |channels| * |increment|
96 // |start| + 2 * |channels| * |increment|, and so on.
97 // Data for subsequent channels is similar. No check is done that |format|
98 // requires data to be of type T, but it is verified that |format| is an
99 // interleaved format.
100 // 94 //
101 // For planar formats, there will be a block for each of |channel| channels. 95 // E.g., for a stereo buffer the values in channel 0 will be:
102 // |start| and |increment| are used to specify the values for the samples, which 96 // start
103 // are created in channel order. Since this is planar data, channel 0 data will 97 // start + increment
104 // be: 98 // start + 2 * increment, ...
105 // |start|
106 // |start| + |increment|
107 // |start| + 2 * |increment|, and so on.
108 // Data for channel 1 will follow where channel 0 ends. Subsequent channels are
109 // similar. No check is done that |format| requires data to be of type T, but it
110 // is verified that |format| is a planar format.
111 // 99 //
112 // |start_time| will be used as the start time for the samples. |duration| is 100 // While, values in channel 1 will be:
113 // the duration. 101 // start + frames * increment
102 // start + (frames + 1) * increment
103 // start + (frames + 2) * increment, ...
104 //
105 // |start_time| will be used as the start time for the samples.
114 template <class T> 106 template <class T>
115 scoped_refptr<AudioBuffer> MakeAudioBuffer(SampleFormat format, 107 scoped_refptr<AudioBuffer> MakeAudioBuffer(SampleFormat format,
116 ChannelLayout channel_layout, 108 ChannelLayout channel_layout,
117 int channel_count, 109 size_t channel_count,
118 int sample_rate, 110 int sample_rate,
119 T start, 111 T start,
120 T increment, 112 T increment,
121 int frames, 113 size_t frames,
122 base::TimeDelta timestamp, 114 base::TimeDelta timestamp);
123 base::TimeDelta duration);
124 115
125 // Create a fake video DecoderBuffer for testing purpose. The buffer contains 116 // Create a fake video DecoderBuffer for testing purpose. The buffer contains
126 // part of video decoder config info embedded so that the testing code can do 117 // part of video decoder config info embedded so that the testing code can do
127 // some sanity check. 118 // some sanity check.
128 scoped_refptr<DecoderBuffer> CreateFakeVideoBufferForTest( 119 scoped_refptr<DecoderBuffer> CreateFakeVideoBufferForTest(
129 const VideoDecoderConfig& config, 120 const VideoDecoderConfig& config,
130 base::TimeDelta timestamp, 121 base::TimeDelta timestamp,
131 base::TimeDelta duration); 122 base::TimeDelta duration);
132 123
133 // Verify if a fake video DecoderBuffer is valid. 124 // Verify if a fake video DecoderBuffer is valid.
134 bool VerifyFakeVideoBufferForTest(const scoped_refptr<DecoderBuffer>& buffer, 125 bool VerifyFakeVideoBufferForTest(const scoped_refptr<DecoderBuffer>& buffer,
135 const VideoDecoderConfig& config); 126 const VideoDecoderConfig& config);
136 127
137 } // namespace media 128 } // namespace media
138 129
139 #endif // MEDIA_BASE_TEST_HELPERS_H_ 130 #endif // MEDIA_BASE_TEST_HELPERS_H_
OLDNEW
« no previous file with comments | « media/base/audio_splicer_unittest.cc ('k') | media/base/test_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698