| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 scoped_ptr<Demuxer> GetDemuxer() { return owned_chunk_demuxer_.Pass(); } | 491 scoped_ptr<Demuxer> GetDemuxer() { return owned_chunk_demuxer_.Pass(); } |
| 492 | 492 |
| 493 void set_encrypted_media_init_data_cb( | 493 void set_encrypted_media_init_data_cb( |
| 494 const Demuxer::EncryptedMediaInitDataCB& encrypted_media_init_data_cb) { | 494 const Demuxer::EncryptedMediaInitDataCB& encrypted_media_init_data_cb) { |
| 495 encrypted_media_init_data_cb_ = encrypted_media_init_data_cb; | 495 encrypted_media_init_data_cb_ = encrypted_media_init_data_cb; |
| 496 } | 496 } |
| 497 | 497 |
| 498 void Seek(base::TimeDelta seek_time, int new_position, int seek_append_size) { | 498 void Seek(base::TimeDelta seek_time, int new_position, int seek_append_size) { |
| 499 chunk_demuxer_->StartWaitingForSeek(seek_time); | 499 chunk_demuxer_->StartWaitingForSeek(seek_time); |
| 500 | 500 |
| 501 chunk_demuxer_->Abort( | 501 chunk_demuxer_->ResetParserState( |
| 502 kSourceId, | 502 kSourceId, |
| 503 base::TimeDelta(), kInfiniteDuration(), &last_timestamp_offset_); | 503 base::TimeDelta(), kInfiniteDuration(), &last_timestamp_offset_); |
| 504 | 504 |
| 505 DCHECK_GE(new_position, 0); | 505 DCHECK_GE(new_position, 0); |
| 506 DCHECK_LT(new_position, file_data_->data_size()); | 506 DCHECK_LT(new_position, file_data_->data_size()); |
| 507 current_position_ = new_position; | 507 current_position_ = new_position; |
| 508 | 508 |
| 509 AppendData(seek_append_size); | 509 AppendData(seek_append_size); |
| 510 } | 510 } |
| 511 | 511 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 last_timestamp_offset_ = timestamp_offset; | 555 last_timestamp_offset_ = timestamp_offset; |
| 556 } | 556 } |
| 557 | 557 |
| 558 void EndOfStream() { | 558 void EndOfStream() { |
| 559 chunk_demuxer_->MarkEndOfStream(PIPELINE_OK); | 559 chunk_demuxer_->MarkEndOfStream(PIPELINE_OK); |
| 560 } | 560 } |
| 561 | 561 |
| 562 void Shutdown() { | 562 void Shutdown() { |
| 563 if (!chunk_demuxer_) | 563 if (!chunk_demuxer_) |
| 564 return; | 564 return; |
| 565 chunk_demuxer_->Abort( | 565 chunk_demuxer_->ResetParserState( |
| 566 kSourceId, | 566 kSourceId, |
| 567 base::TimeDelta(), kInfiniteDuration(), &last_timestamp_offset_); | 567 base::TimeDelta(), kInfiniteDuration(), &last_timestamp_offset_); |
| 568 chunk_demuxer_->Shutdown(); | 568 chunk_demuxer_->Shutdown(); |
| 569 chunk_demuxer_ = NULL; | 569 chunk_demuxer_ = NULL; |
| 570 } | 570 } |
| 571 | 571 |
| 572 void DemuxerOpened() { | 572 void DemuxerOpened() { |
| 573 base::MessageLoop::current()->PostTask( | 573 base::MessageLoop::current()->PostTask( |
| 574 FROM_HERE, base::Bind(&MockMediaSource::DemuxerOpenedTask, | 574 FROM_HERE, base::Bind(&MockMediaSource::DemuxerOpenedTask, |
| 575 base::Unretained(this))); | 575 base::Unretained(this))); |
| (...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1839 | 1839 |
| 1840 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { | 1840 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { |
| 1841 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); | 1841 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); |
| 1842 Play(); | 1842 Play(); |
| 1843 ASSERT_TRUE(WaitUntilOnEnded()); | 1843 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1844 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), | 1844 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), |
| 1845 demuxer_->GetStartTime()); | 1845 demuxer_->GetStartTime()); |
| 1846 } | 1846 } |
| 1847 | 1847 |
| 1848 } // namespace media | 1848 } // namespace media |
| OLD | NEW |