| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/media/buffered_data_source.h" | 5 #include "webkit/media/buffered_data_source.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "media/base/filter_host.h" | |
| 9 #include "media/base/media_log.h" | 8 #include "media/base/media_log.h" |
| 10 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 11 #include "webkit/media/web_data_source_factory.h" | 10 #include "webkit/media/web_data_source_factory.h" |
| 12 | 11 |
| 13 using WebKit::WebFrame; | 12 using WebKit::WebFrame; |
| 14 | 13 |
| 15 namespace webkit_media { | 14 namespace webkit_media { |
| 16 | 15 |
| 17 // BufferedDataSource has an intermediate buffer, this value governs the initial | 16 // BufferedDataSource has an intermediate buffer, this value governs the initial |
| 18 // size of that buffer. It is set to 32KB because this is a typical read size | 17 // size of that buffer. It is set to 32KB because this is a typical read size |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 77 |
| 79 return new BufferedResourceLoader(url_, | 78 return new BufferedResourceLoader(url_, |
| 80 first_byte_position, | 79 first_byte_position, |
| 81 last_byte_position, | 80 last_byte_position, |
| 82 ChooseDeferStrategy(), | 81 ChooseDeferStrategy(), |
| 83 bitrate_, | 82 bitrate_, |
| 84 playback_rate_, | 83 playback_rate_, |
| 85 media_log_); | 84 media_log_); |
| 86 } | 85 } |
| 87 | 86 |
| 88 void BufferedDataSource::set_host(media::FilterHost* host) { | 87 void BufferedDataSource::set_host(media::DataSourceHost* host) { |
| 89 DataSource::set_host(host); | 88 DataSource::set_host(host); |
| 90 | 89 |
| 91 if (loader_.get()) { | 90 if (loader_.get()) { |
| 92 base::AutoLock auto_lock(lock_); | 91 base::AutoLock auto_lock(lock_); |
| 93 UpdateHostState_Locked(); | 92 UpdateHostState_Locked(); |
| 94 } | 93 } |
| 95 } | 94 } |
| 96 | 95 |
| 97 void BufferedDataSource::Initialize(const std::string& url, | 96 void BufferedDataSource::Initialize(const std::string& url, |
| 98 const media::PipelineStatusCB& callback) { | 97 const media::PipelineStatusCB& callback) { |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 | 642 |
| 644 buffered_bytes_ = buffered_position + 1; | 643 buffered_bytes_ = buffered_position + 1; |
| 645 if (host()) | 644 if (host()) |
| 646 host()->SetBufferedBytes(buffered_bytes_); | 645 host()->SetBufferedBytes(buffered_bytes_); |
| 647 } | 646 } |
| 648 | 647 |
| 649 void BufferedDataSource::UpdateHostState_Locked() { | 648 void BufferedDataSource::UpdateHostState_Locked() { |
| 650 // Called from various threads, under lock. | 649 // Called from various threads, under lock. |
| 651 lock_.AssertAcquired(); | 650 lock_.AssertAcquired(); |
| 652 | 651 |
| 653 media::FilterHost* filter_host = host(); | 652 if (!host()) |
| 654 if (!filter_host) | |
| 655 return; | 653 return; |
| 656 | 654 |
| 657 if (total_bytes_ != kPositionNotSpecified) | 655 if (total_bytes_ != kPositionNotSpecified) |
| 658 filter_host->SetTotalBytes(total_bytes_); | 656 host()->SetTotalBytes(total_bytes_); |
| 659 filter_host->SetBufferedBytes(buffered_bytes_); | 657 host()->SetBufferedBytes(buffered_bytes_); |
| 660 } | 658 } |
| 661 | 659 |
| 662 } // namespace webkit_media | 660 } // namespace webkit_media |
| OLD | NEW |