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

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

Issue 239743005: Updates WebMediaPlayerAndroid and MediaSourceDelegate to respect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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
OLDNEW
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 #include <string> 5 #include <string>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // use by tests, only where required. 244 // use by tests, only where required.
245 bool IsPendingSurfaceChange() { 245 bool IsPendingSurfaceChange() {
246 return player_.IsEventPending(player_.SURFACE_CHANGE_EVENT_PENDING); 246 return player_.IsEventPending(player_.SURFACE_CHANGE_EVENT_PENDING);
247 } 247 }
248 248
249 DemuxerConfigs CreateAudioDemuxerConfigs(AudioCodec audio_codec) { 249 DemuxerConfigs CreateAudioDemuxerConfigs(AudioCodec audio_codec) {
250 DemuxerConfigs configs; 250 DemuxerConfigs configs;
251 configs.audio_codec = audio_codec; 251 configs.audio_codec = audio_codec;
252 configs.audio_channels = 2; 252 configs.audio_channels = 2;
253 configs.is_audio_encrypted = false; 253 configs.is_audio_encrypted = false;
254 configs.duration_ms = kDefaultDurationInMs; 254 configs.duration = base::TimeDelta::FromMilliseconds(kDefaultDurationInMs);
damienv1 2014/04/16 22:01:00 Cleaner: change: const base::TimeDelta kDefaultDur
gunsch 2014/04/16 22:05:18 Done.
255 255
256 if (audio_codec == kCodecVorbis) { 256 if (audio_codec == kCodecVorbis) {
257 configs.audio_sampling_rate = 44100; 257 configs.audio_sampling_rate = 44100;
258 scoped_refptr<DecoderBuffer> buffer = ReadTestDataFile( 258 scoped_refptr<DecoderBuffer> buffer = ReadTestDataFile(
259 "vorbis-extradata"); 259 "vorbis-extradata");
260 configs.audio_extra_data = std::vector<uint8>( 260 configs.audio_extra_data = std::vector<uint8>(
261 buffer->data(), 261 buffer->data(),
262 buffer->data() + buffer->data_size()); 262 buffer->data() + buffer->data_size());
263 return configs; 263 return configs;
264 } 264 }
265 265
266 // Other codecs are not yet supported by this helper. 266 // Other codecs are not yet supported by this helper.
267 EXPECT_EQ(audio_codec, kCodecAAC); 267 EXPECT_EQ(audio_codec, kCodecAAC);
268 268
269 configs.audio_sampling_rate = 48000; 269 configs.audio_sampling_rate = 48000;
270 uint8 aac_extra_data[] = { 0x13, 0x10 }; 270 uint8 aac_extra_data[] = { 0x13, 0x10 };
271 configs.audio_extra_data = std::vector<uint8>( 271 configs.audio_extra_data = std::vector<uint8>(
272 aac_extra_data, 272 aac_extra_data,
273 aac_extra_data + 2); 273 aac_extra_data + 2);
274 return configs; 274 return configs;
275 } 275 }
276 276
277 DemuxerConfigs CreateVideoDemuxerConfigs() { 277 DemuxerConfigs CreateVideoDemuxerConfigs() {
278 DemuxerConfigs configs; 278 DemuxerConfigs configs;
279 configs.video_codec = kCodecVP8; 279 configs.video_codec = kCodecVP8;
280 configs.video_size = gfx::Size(320, 240); 280 configs.video_size = gfx::Size(320, 240);
281 configs.is_video_encrypted = false; 281 configs.is_video_encrypted = false;
282 configs.duration_ms = kDefaultDurationInMs; 282 configs.duration = base::TimeDelta::FromMilliseconds(kDefaultDurationInMs);
283 return configs; 283 return configs;
284 } 284 }
285 285
286 DemuxerConfigs CreateAudioVideoDemuxerConfigs() { 286 DemuxerConfigs CreateAudioVideoDemuxerConfigs() {
287 DemuxerConfigs configs = CreateAudioDemuxerConfigs(kCodecVorbis); 287 DemuxerConfigs configs = CreateAudioDemuxerConfigs(kCodecVorbis);
288 configs.video_codec = kCodecVP8; 288 configs.video_codec = kCodecVP8;
289 configs.video_size = gfx::Size(320, 240); 289 configs.video_size = gfx::Size(320, 240);
290 configs.is_video_encrypted = false; 290 configs.is_video_encrypted = false;
291 return configs; 291 return configs;
292 } 292 }
(...skipping 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after
2058 DemuxerConfigs configs = CreateVideoDemuxerConfigs(); 2058 DemuxerConfigs configs = CreateVideoDemuxerConfigs();
2059 configs.is_video_encrypted = true; 2059 configs.is_video_encrypted = true;
2060 2060
2061 player_.OnDemuxerConfigsAvailable(configs); 2061 player_.OnDemuxerConfigsAvailable(configs);
2062 CreateNextTextureAndSetVideoSurface(); 2062 CreateNextTextureAndSetVideoSurface();
2063 EXPECT_FALSE(IsPendingSurfaceChange()); 2063 EXPECT_FALSE(IsPendingSurfaceChange());
2064 EXPECT_FALSE(GetMediaDecoderJob(false)); 2064 EXPECT_FALSE(GetMediaDecoderJob(false));
2065 } 2065 }
2066 2066
2067 } // namespace media 2067 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698