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

Side by Side Diff: media/base/android/sdk_media_codec_bridge_unittest.cc

Issue 1601863002: Remove non-batching assumptions from SdkMediaCodecBridgeTest.DoNormal (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 status = media_codec->DequeueInputBuffer(InfiniteTimeOut(), &input_buf_index); 175 status = media_codec->DequeueInputBuffer(InfiniteTimeOut(), &input_buf_index);
176 media_codec->QueueInputBuffer(input_buf_index, test_mp3, sizeof(test_mp3), 176 media_codec->QueueInputBuffer(input_buf_index, test_mp3, sizeof(test_mp3),
177 base::TimeDelta::FromMicroseconds(++input_pts)); 177 base::TimeDelta::FromMicroseconds(++input_pts));
178 178
179 status = media_codec->DequeueInputBuffer(InfiniteTimeOut(), &input_buf_index); 179 status = media_codec->DequeueInputBuffer(InfiniteTimeOut(), &input_buf_index);
180 media_codec->QueueEOS(input_buf_index); 180 media_codec->QueueEOS(input_buf_index);
181 181
182 input_pts = kPresentationTimeBase; 182 input_pts = kPresentationTimeBase;
183 bool eos = false; 183 bool eos = false;
184 size_t total_size = 0;
184 while (!eos) { 185 while (!eos) {
185 size_t unused_offset = 0; 186 size_t unused_offset = 0;
186 size_t size = 0; 187 size_t size = 0;
187 base::TimeDelta timestamp; 188 base::TimeDelta timestamp;
188 int output_buf_index = -1; 189 int output_buf_index = -1;
189 status = media_codec->DequeueOutputBuffer(InfiniteTimeOut(), 190 status = media_codec->DequeueOutputBuffer(InfiniteTimeOut(),
190 &output_buf_index, &unused_offset, 191 &output_buf_index, &unused_offset,
191 &size, &timestamp, &eos, nullptr); 192 &size, &timestamp, &eos, nullptr);
192 switch (status) { 193 switch (status) {
193 case MEDIA_CODEC_DEQUEUE_OUTPUT_AGAIN_LATER: 194 case MEDIA_CODEC_DEQUEUE_OUTPUT_AGAIN_LATER:
194 FAIL(); 195 FAIL();
195 return; 196 return;
196 197
197 case MEDIA_CODEC_OUTPUT_FORMAT_CHANGED: 198 case MEDIA_CODEC_OUTPUT_FORMAT_CHANGED:
198 continue; 199 continue;
199 200
200 case MEDIA_CODEC_OUTPUT_BUFFERS_CHANGED: 201 case MEDIA_CODEC_OUTPUT_BUFFERS_CHANGED:
201 continue; 202 continue;
202 203
203 default: 204 default:
204 break; 205 break;
205 } 206 }
206 ASSERT_GE(output_buf_index, 0); 207 ASSERT_GE(output_buf_index, 0);
207 EXPECT_LE(1u, size); 208 EXPECT_LE(1u, size);
209 total_size += size;
208 if (!eos) 210 if (!eos)
209 EXPECT_EQ(++input_pts, timestamp.InMicroseconds()); 211 EXPECT_EQ(++input_pts, timestamp.InMicroseconds());
qinmin 2016/01/19 00:57:49 should this also be removed? it is possible that t
kraush 2016/01/19 17:33:58 Acknowledged.
210 ASSERT_LE(input_pts, kPresentationTimeBase + 2); 212 ASSERT_LE(input_pts, kPresentationTimeBase + 2);
211 } 213 }
212 ASSERT_EQ(input_pts, kPresentationTimeBase + 2); 214 EXPECT_EQ(9216u, total_size);
215 ASSERT_LE(input_pts, kPresentationTimeBase + 2);
213 } 216 }
214 217
215 TEST(SdkMediaCodecBridgeTest, InvalidVorbisHeader) { 218 TEST(SdkMediaCodecBridgeTest, InvalidVorbisHeader) {
216 SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE(); 219 SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE();
217 220
218 scoped_ptr<media::AudioCodecBridge> media_codec; 221 scoped_ptr<media::AudioCodecBridge> media_codec;
219 media_codec.reset(AudioCodecBridge::Create(kCodecVorbis)); 222 media_codec.reset(AudioCodecBridge::Create(kCodecVorbis));
220 223
221 // The first byte of the header is not 0x02. 224 // The first byte of the header is not 0x02.
222 uint8_t invalid_first_byte[] = {0x00, 0xff, 0xff, 0xff, 0xff}; 225 uint8_t invalid_first_byte[] = {0x00, 0xff, 0xff, 0xff, 0xff};
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 296 }
294 297
295 TEST(SdkMediaCodecBridgeTest, CreateUnsupportedCodec) { 298 TEST(SdkMediaCodecBridgeTest, CreateUnsupportedCodec) {
296 EXPECT_EQ(nullptr, AudioCodecBridge::Create(kUnknownAudioCodec)); 299 EXPECT_EQ(nullptr, AudioCodecBridge::Create(kUnknownAudioCodec));
297 EXPECT_EQ(nullptr, VideoCodecBridge::CreateDecoder(kUnknownVideoCodec, false, 300 EXPECT_EQ(nullptr, VideoCodecBridge::CreateDecoder(kUnknownVideoCodec, false,
298 gfx::Size(320, 240), 301 gfx::Size(320, 240),
299 nullptr, nullptr)); 302 nullptr, nullptr));
300 } 303 }
301 304
302 } // namespace media 305 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698