OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/media/buffered_data_source.h" | 5 #include "content/renderer/media/buffered_data_source.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "content/public/common/url_constants.h" |
10 #include "media/base/media_log.h" | 11 #include "media/base/media_log.h" |
11 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
12 | 13 |
13 using blink::WebFrame; | 14 using blink::WebFrame; |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
17 // BufferedDataSource has an intermediate buffer, this value governs the initial | 18 // 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 | 19 // size of that buffer. It is set to 32KB because this is a typical read size |
19 // of FFmpeg. | 20 // of FFmpeg. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // static | 75 // static |
75 void BufferedDataSource::ReadOperation::Run( | 76 void BufferedDataSource::ReadOperation::Run( |
76 scoped_ptr<ReadOperation> read_op, int result) { | 77 scoped_ptr<ReadOperation> read_op, int result) { |
77 base::ResetAndReturn(&read_op->callback_).Run(result); | 78 base::ResetAndReturn(&read_op->callback_).Run(result); |
78 } | 79 } |
79 | 80 |
80 BufferedDataSource::BufferedDataSource( | 81 BufferedDataSource::BufferedDataSource( |
81 const scoped_refptr<base::MessageLoopProxy>& render_loop, | 82 const scoped_refptr<base::MessageLoopProxy>& render_loop, |
82 WebFrame* frame, | 83 WebFrame* frame, |
83 media::MediaLog* media_log, | 84 media::MediaLog* media_log, |
84 media::DataSourceHost* host, | 85 BufferedDataSourceHost* host, |
85 const DownloadingCB& downloading_cb) | 86 const DownloadingCB& downloading_cb) |
86 : cors_mode_(BufferedResourceLoader::kUnspecified), | 87 : cors_mode_(BufferedResourceLoader::kUnspecified), |
87 total_bytes_(kPositionNotSpecified), | 88 total_bytes_(kPositionNotSpecified), |
88 assume_fully_buffered_(false), | 89 assume_fully_buffered_(false), |
89 streaming_(false), | 90 streaming_(false), |
90 frame_(frame), | 91 frame_(frame), |
91 intermediate_read_buffer_(new uint8[kInitialReadBufferSize]), | 92 intermediate_read_buffer_(new uint8[kInitialReadBufferSize]), |
92 intermediate_read_buffer_size_(kInitialReadBufferSize), | 93 intermediate_read_buffer_size_(kInitialReadBufferSize), |
93 render_loop_(render_loop), | 94 render_loop_(render_loop), |
94 stop_signal_received_(false), | 95 stop_signal_received_(false), |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 return; | 531 return; |
531 } | 532 } |
532 | 533 |
533 // If media is currently playing or the page indicated preload=auto, | 534 // If media is currently playing or the page indicated preload=auto, |
534 // use threshold strategy to enable/disable deferring when the buffer | 535 // use threshold strategy to enable/disable deferring when the buffer |
535 // is full/depleted. | 536 // is full/depleted. |
536 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer); | 537 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer); |
537 } | 538 } |
538 | 539 |
539 } // namespace content | 540 } // namespace content |
OLD | NEW |