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

Side by Side Diff: media/webm/webm_cluster_parser_unittest.cc

Issue 23702007: Render inband text tracks in the media pipeline (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix compile errors 11/21 #6 Created 7 years, 1 month 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 | « media/webm/webm_cluster_parser.cc ('k') | media/webm/webm_stream_parser.h » ('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 #include <algorithm> 5 #include <algorithm>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "media/base/decrypt_config.h" 9 #include "media/base/decrypt_config.h"
10 #include "media/webm/cluster_builder.h" 10 #include "media/webm/cluster_builder.h"
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 CreateCluster(0, kInputBlockInfo, input_block_count)); 367 CreateCluster(0, kInputBlockInfo, input_block_count));
368 368
369 int result = parser_->Parse(cluster->data(), cluster->size()); 369 int result = parser_->Parse(cluster->data(), cluster->size());
370 EXPECT_EQ(cluster->size(), result); 370 EXPECT_EQ(cluster->size(), result);
371 ASSERT_TRUE(VerifyBuffers(parser_, kOutputBlockInfo, output_block_count)); 371 ASSERT_TRUE(VerifyBuffers(parser_, kOutputBlockInfo, output_block_count));
372 } 372 }
373 373
374 TEST_F(WebMClusterParserTest, ParseTextTracks) { 374 TEST_F(WebMClusterParserTest, ParseTextTracks) {
375 typedef WebMTracksParser::TextTracks TextTracks; 375 typedef WebMTracksParser::TextTracks TextTracks;
376 TextTracks text_tracks; 376 TextTracks text_tracks;
377 WebMTracksParser::TextTrackInfo text_track_info;
378 377
379 text_track_info.kind = kTextSubtitles;
380 text_tracks.insert(std::make_pair(TextTracks::key_type(kTextTrackNum), 378 text_tracks.insert(std::make_pair(TextTracks::key_type(kTextTrackNum),
381 text_track_info)); 379 TextTrackConfig(kTextSubtitles, "", "")));
382 380
383 parser_.reset(new WebMClusterParser(kTimecodeScale, 381 parser_.reset(new WebMClusterParser(kTimecodeScale,
384 kAudioTrackNum, 382 kAudioTrackNum,
385 kVideoTrackNum, 383 kVideoTrackNum,
386 text_tracks, 384 text_tracks,
387 std::set<int64>(), 385 std::set<int64>(),
388 std::string(), 386 std::string(),
389 std::string(), 387 std::string(),
390 LogCB())); 388 LogCB()));
391 389
(...skipping 11 matching lines...) Expand all
403 scoped_ptr<Cluster> cluster( 401 scoped_ptr<Cluster> cluster(
404 CreateCluster(0, kInputBlockInfo, input_block_count)); 402 CreateCluster(0, kInputBlockInfo, input_block_count));
405 403
406 int result = parser_->Parse(cluster->data(), cluster->size()); 404 int result = parser_->Parse(cluster->data(), cluster->size());
407 EXPECT_EQ(cluster->size(), result); 405 EXPECT_EQ(cluster->size(), result);
408 ASSERT_TRUE(VerifyBuffers(parser_, kInputBlockInfo, input_block_count)); 406 ASSERT_TRUE(VerifyBuffers(parser_, kInputBlockInfo, input_block_count));
409 } 407 }
410 408
411 TEST_F(WebMClusterParserTest, TextTracksSimpleBlock) { 409 TEST_F(WebMClusterParserTest, TextTracksSimpleBlock) {
412 typedef WebMTracksParser::TextTracks TextTracks; 410 typedef WebMTracksParser::TextTracks TextTracks;
413 TextTracks text_tracks; 411 WebMTracksParser::TextTracks text_tracks;
414 WebMTracksParser::TextTrackInfo text_track_info;
415 412
416 text_track_info.kind = kTextSubtitles;
417 text_tracks.insert(std::make_pair(TextTracks::key_type(kTextTrackNum), 413 text_tracks.insert(std::make_pair(TextTracks::key_type(kTextTrackNum),
418 text_track_info)); 414 TextTrackConfig(kTextSubtitles, "", "")));
419 415
420 parser_.reset(new WebMClusterParser(kTimecodeScale, 416 parser_.reset(new WebMClusterParser(kTimecodeScale,
421 kAudioTrackNum, 417 kAudioTrackNum,
422 kVideoTrackNum, 418 kVideoTrackNum,
423 text_tracks, 419 text_tracks,
424 std::set<int64>(), 420 std::set<int64>(),
425 std::string(), 421 std::string(),
426 std::string(), 422 std::string(),
427 LogCB())); 423 LogCB()));
428 424
429 const BlockInfo kInputBlockInfo[] = { 425 const BlockInfo kInputBlockInfo[] = {
430 { kTextTrackNum, 33, 42, true }, 426 { kTextTrackNum, 33, 42, true },
431 }; 427 };
432 int input_block_count = arraysize(kInputBlockInfo); 428 int input_block_count = arraysize(kInputBlockInfo);
433 429
434 scoped_ptr<Cluster> cluster( 430 scoped_ptr<Cluster> cluster(
435 CreateCluster(0, kInputBlockInfo, input_block_count)); 431 CreateCluster(0, kInputBlockInfo, input_block_count));
436 432
437 int result = parser_->Parse(cluster->data(), cluster->size()); 433 int result = parser_->Parse(cluster->data(), cluster->size());
438 EXPECT_LT(result, 0); 434 EXPECT_LT(result, 0);
439 } 435 }
440 436
441 TEST_F(WebMClusterParserTest, ParseMultipleTextTracks) { 437 TEST_F(WebMClusterParserTest, ParseMultipleTextTracks) {
442 typedef WebMTracksParser::TextTracks TextTracks; 438 typedef WebMTracksParser::TextTracks TextTracks;
443 TextTracks text_tracks; 439 TextTracks text_tracks;
444 WebMTracksParser::TextTrackInfo text_track_info;
445 440
446 const int kSubtitleTextTrackNum = kTextTrackNum; 441 const int kSubtitleTextTrackNum = kTextTrackNum;
447 const int kCaptionTextTrackNum = kTextTrackNum + 1; 442 const int kCaptionTextTrackNum = kTextTrackNum + 1;
448 443
449 text_track_info.kind = kTextSubtitles;
450 text_tracks.insert(std::make_pair(TextTracks::key_type(kSubtitleTextTrackNum), 444 text_tracks.insert(std::make_pair(TextTracks::key_type(kSubtitleTextTrackNum),
451 text_track_info)); 445 TextTrackConfig(kTextSubtitles, "", "")));
452 446
453 text_track_info.kind = kTextCaptions;
454 text_tracks.insert(std::make_pair(TextTracks::key_type(kCaptionTextTrackNum), 447 text_tracks.insert(std::make_pair(TextTracks::key_type(kCaptionTextTrackNum),
455 text_track_info)); 448 TextTrackConfig(kTextCaptions, "", "")));
456 449
457 parser_.reset(new WebMClusterParser(kTimecodeScale, 450 parser_.reset(new WebMClusterParser(kTimecodeScale,
458 kAudioTrackNum, 451 kAudioTrackNum,
459 kVideoTrackNum, 452 kVideoTrackNum,
460 text_tracks, 453 text_tracks,
461 std::set<int64>(), 454 std::set<int64>(),
462 std::string(), 455 std::string(),
463 std::string(), 456 std::string(),
464 LogCB())); 457 LogCB()));
465 458
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 WebMTracksParser::TextTracks(), 517 WebMTracksParser::TextTracks(),
525 std::set<int64>(), 518 std::set<int64>(),
526 std::string(), 519 std::string(),
527 "video_key_id", 520 "video_key_id",
528 LogCB())); 521 LogCB()));
529 int result = parser_->Parse(cluster->data(), cluster->size()); 522 int result = parser_->Parse(cluster->data(), cluster->size());
530 EXPECT_EQ(-1, result); 523 EXPECT_EQ(-1, result);
531 } 524 }
532 525
533 } // namespace media 526 } // namespace media
OLDNEW
« no previous file with comments | « media/webm/webm_cluster_parser.cc ('k') | media/webm/webm_stream_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698