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/glue/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" | 8 #include "media/base/filter_host.h" |
9 #include "media/base/media_log.h" | 9 #include "media/base/media_log.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
11 #include "webkit/glue/media/web_data_source_factory.h" | 11 #include "webkit/media/web_data_source_factory.h" |
12 #include "webkit/glue/webkit_glue.h" | 12 #include "webkit/glue/webkit_glue.h" |
13 | 13 |
14 using WebKit::WebFrame; | 14 using WebKit::WebFrame; |
15 | 15 |
16 namespace webkit_glue { | 16 namespace webkit_media { |
17 | 17 |
18 // BufferedDataSource has an intermediate buffer, this value governs the initial | 18 // BufferedDataSource has an intermediate buffer, this value governs the initial |
19 // size of that buffer. It is set to 32KB because this is a typical read size | 19 // size of that buffer. It is set to 32KB because this is a typical read size |
20 // of FFmpeg. | 20 // of FFmpeg. |
21 static const int kInitialReadBufferSize = 32768; | 21 static const int kInitialReadBufferSize = 32768; |
22 | 22 |
23 // Number of cache misses we allow for a single Read() before signalling an | 23 // Number of cache misses we allow for a single Read() before signalling an |
24 // error. | 24 // error. |
25 static const int kNumCacheMissRetries = 3; | 25 static const int kNumCacheMissRetries = 3; |
26 | 26 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 void BufferedDataSource::Initialize(const std::string& url, | 99 void BufferedDataSource::Initialize(const std::string& url, |
100 const media::PipelineStatusCB& callback) { | 100 const media::PipelineStatusCB& callback) { |
101 // Saves the url. | 101 // Saves the url. |
102 url_ = GURL(url); | 102 url_ = GURL(url); |
103 | 103 |
104 // This data source doesn't support data:// protocol so reject it. | 104 // This data source doesn't support data:// protocol so reject it. |
105 if (url_.SchemeIs(kDataScheme)) { | 105 if (url_.SchemeIs(kDataScheme)) { |
106 callback.Run(media::DATASOURCE_ERROR_URL_NOT_SUPPORTED); | 106 callback.Run(media::DATASOURCE_ERROR_URL_NOT_SUPPORTED); |
107 return; | 107 return; |
108 } else if (!IsProtocolSupportedForMedia(url_)) { | 108 } else if (!webkit_glue::IsProtocolSupportedForMedia(url_)) { |
109 callback.Run(media::PIPELINE_ERROR_NETWORK); | 109 callback.Run(media::PIPELINE_ERROR_NETWORK); |
110 return; | 110 return; |
111 } | 111 } |
112 | 112 |
113 DCHECK(!callback.is_null()); | 113 DCHECK(!callback.is_null()); |
114 { | 114 { |
115 base::AutoLock auto_lock(lock_); | 115 base::AutoLock auto_lock(lock_); |
116 initialize_cb_ = callback; | 116 initialize_cb_ = callback; |
117 } | 117 } |
118 | 118 |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 filter_host->SetLoaded(loaded_); | 662 filter_host->SetLoaded(loaded_); |
663 | 663 |
664 if (streaming_) { | 664 if (streaming_) { |
665 filter_host->SetStreaming(true); | 665 filter_host->SetStreaming(true); |
666 } else { | 666 } else { |
667 filter_host->SetTotalBytes(total_bytes_); | 667 filter_host->SetTotalBytes(total_bytes_); |
668 filter_host->SetBufferedBytes(buffered_bytes_); | 668 filter_host->SetBufferedBytes(buffered_bytes_); |
669 } | 669 } |
670 } | 670 } |
671 | 671 |
672 } // namespace webkit_glue | 672 } // namespace webkit_media |
OLD | NEW |