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

Side by Side Diff: media/test/pipeline_integration_test.cc

Issue 2226443002: Support multiple media tracks in MSE / ChunkDemuxer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed integer overflow Created 4 years, 3 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 (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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 const uint8_t* pData, 554 const uint8_t* pData,
555 int size) { 555 int size) {
556 CHECK(!chunk_demuxer_->IsParsingMediaSegment(kSourceId)); 556 CHECK(!chunk_demuxer_->IsParsingMediaSegment(kSourceId));
557 ASSERT_TRUE( 557 ASSERT_TRUE(
558 chunk_demuxer_->AppendData(kSourceId, pData, size, append_window_start, 558 chunk_demuxer_->AppendData(kSourceId, pData, size, append_window_start,
559 append_window_end, &timestamp_offset)); 559 append_window_end, &timestamp_offset));
560 last_timestamp_offset_ = timestamp_offset; 560 last_timestamp_offset_ = timestamp_offset;
561 } 561 }
562 562
563 void SetMemoryLimits(size_t limit_bytes) { 563 void SetMemoryLimits(size_t limit_bytes) {
564 chunk_demuxer_->SetMemoryLimits(DemuxerStream::AUDIO, limit_bytes); 564 chunk_demuxer_->SetMemoryLimitsForTest(DemuxerStream::AUDIO, limit_bytes);
565 chunk_demuxer_->SetMemoryLimits(DemuxerStream::VIDEO, limit_bytes); 565 chunk_demuxer_->SetMemoryLimitsForTest(DemuxerStream::VIDEO, limit_bytes);
566 } 566 }
567 567
568 void EvictCodedFrames(base::TimeDelta currentMediaTime, size_t newDataSize) { 568 void EvictCodedFrames(base::TimeDelta currentMediaTime, size_t newDataSize) {
569 chunk_demuxer_->EvictCodedFrames(kSourceId, currentMediaTime, newDataSize); 569 chunk_demuxer_->EvictCodedFrames(kSourceId, currentMediaTime, newDataSize);
570 } 570 }
571 571
572 void RemoveRange(base::TimeDelta start, base::TimeDelta end) { 572 void RemoveRange(base::TimeDelta start, base::TimeDelta end) {
573 chunk_demuxer_->Remove(kSourceId, start, end); 573 chunk_demuxer_->Remove(kSourceId, start, end);
574 } 574 }
575 575
(...skipping 28 matching lines...) Expand all
604 604
605 AppendData(initial_append_size_); 605 AppendData(initial_append_size_);
606 } 606 }
607 607
608 ChunkDemuxer::Status AddId() { 608 ChunkDemuxer::Status AddId() {
609 // This code assumes that |mimetype_| is one of the following forms. 609 // This code assumes that |mimetype_| is one of the following forms.
610 // 1. audio/mpeg 610 // 1. audio/mpeg
611 // 2. video/webm;codec="vorbis,vp8". 611 // 2. video/webm;codec="vorbis,vp8".
612 size_t semicolon = mimetype_.find(";"); 612 size_t semicolon = mimetype_.find(";");
613 std::string type = mimetype_; 613 std::string type = mimetype_;
614 std::vector<std::string> codecs; 614 std::string codecs_param = "";
615 if (semicolon != std::string::npos) { 615 if (semicolon != std::string::npos) {
616 type = mimetype_.substr(0, semicolon); 616 type = mimetype_.substr(0, semicolon);
617 size_t codecs_param_start = mimetype_.find("codecs=\"", semicolon); 617 size_t codecs_param_start = mimetype_.find("codecs=\"", semicolon);
618 618
619 CHECK_NE(codecs_param_start, std::string::npos); 619 CHECK_NE(codecs_param_start, std::string::npos);
620 620
621 codecs_param_start += 8; // Skip over the codecs=". 621 codecs_param_start += 8; // Skip over the codecs=".
622 622
623 size_t codecs_param_end = mimetype_.find("\"", codecs_param_start); 623 size_t codecs_param_end = mimetype_.find("\"", codecs_param_start);
624 624
625 CHECK_NE(codecs_param_end, std::string::npos); 625 CHECK_NE(codecs_param_end, std::string::npos);
626 626
627 std::string codecs_param = mimetype_.substr( 627 codecs_param = mimetype_.substr(codecs_param_start,
628 codecs_param_start, codecs_param_end - codecs_param_start); 628 codecs_param_end - codecs_param_start);
629 codecs = base::SplitString(codecs_param, ",", base::KEEP_WHITESPACE,
630 base::SPLIT_WANT_NONEMPTY);
631 } 629 }
632 630
633 return chunk_demuxer_->AddId(kSourceId, type, codecs); 631 return chunk_demuxer_->AddId(kSourceId, type, codecs_param);
634 } 632 }
635 633
636 void OnEncryptedMediaInitData(EmeInitDataType init_data_type, 634 void OnEncryptedMediaInitData(EmeInitDataType init_data_type,
637 const std::vector<uint8_t>& init_data) { 635 const std::vector<uint8_t>& init_data) {
638 DCHECK(!init_data.empty()); 636 DCHECK(!init_data.empty());
639 CHECK(!encrypted_media_init_data_cb_.is_null()); 637 CHECK(!encrypted_media_init_data_cb_.is_null());
640 encrypted_media_init_data_cb_.Run(init_data_type, init_data); 638 encrypted_media_init_data_cb_.Run(init_data_type, init_data);
641 } 639 }
642 640
643 base::TimeDelta last_timestamp_offset() const { 641 base::TimeDelta last_timestamp_offset() const {
(...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after
2377 2375
2378 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { 2376 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) {
2379 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); 2377 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm"));
2380 Play(); 2378 Play();
2381 ASSERT_TRUE(WaitUntilOnEnded()); 2379 ASSERT_TRUE(WaitUntilOnEnded());
2382 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), 2380 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000),
2383 demuxer_->GetStartTime()); 2381 demuxer_->GetStartTime());
2384 } 2382 }
2385 2383
2386 } // namespace media 2384 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698