OLD | NEW |
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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 |
OLD | NEW |