OLD | NEW |
1 // Copyright (c) 2010 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/glue/media/buffered_data_source.h" |
6 | 6 |
7 #include "media/base/filter_host.h" | 7 #include "media/base/filter_host.h" |
8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
9 #include "webkit/glue/webkit_glue.h" | 9 #include "webkit/glue/webkit_glue.h" |
10 | 10 |
11 using WebKit::WebFrame; | 11 using WebKit::WebFrame; |
12 | 12 |
13 namespace { | 13 namespace webkit_glue { |
14 | 14 |
15 // Defines how long we should wait for more data before we declare a connection | 15 // Defines how long we should wait for more data before we declare a connection |
16 // timeout and start a new request. | 16 // timeout and start a new request. |
17 // TODO(hclam): Set it to 5s, calibrate this value later. | 17 // TODO(hclam): Set it to 5s, calibrate this value later. |
18 const int kTimeoutMilliseconds = 5000; | 18 static const int kTimeoutMilliseconds = 5000; |
19 | 19 |
20 // Defines how many times we should try to read from a buffered resource loader | 20 // Defines how many times we should try to read from a buffered resource loader |
21 // before we declare a read error. After each failure of read from a buffered | 21 // before we declare a read error. After each failure of read from a buffered |
22 // resource loader, a new one is created to be read. | 22 // resource loader, a new one is created to be read. |
23 const int kReadTrials = 3; | 23 static const int kReadTrials = 3; |
24 | 24 |
25 // BufferedDataSource has an intermediate buffer, this value governs the initial | 25 // BufferedDataSource has an intermediate buffer, this value governs the initial |
26 // size of that buffer. It is set to 32KB because this is a typical read size | 26 // size of that buffer. It is set to 32KB because this is a typical read size |
27 // of FFmpeg. | 27 // of FFmpeg. |
28 const int kInitialReadBufferSize = 32768; | 28 static const int kInitialReadBufferSize = 32768; |
29 | |
30 } // namespace | |
31 | |
32 namespace webkit_glue { | |
33 | 29 |
34 BufferedDataSource::BufferedDataSource( | 30 BufferedDataSource::BufferedDataSource( |
35 MessageLoop* render_loop, | 31 MessageLoop* render_loop, |
36 WebFrame* frame) | 32 WebFrame* frame) |
37 : total_bytes_(kPositionNotSpecified), | 33 : total_bytes_(kPositionNotSpecified), |
38 loaded_(false), | 34 loaded_(false), |
39 streaming_(false), | 35 streaming_(false), |
40 frame_(frame), | 36 frame_(frame), |
41 loader_(NULL), | 37 loader_(NULL), |
42 network_activity_(false), | 38 network_activity_(false), |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 return; | 595 return; |
600 | 596 |
601 if (network_activity != network_activity_) { | 597 if (network_activity != network_activity_) { |
602 network_activity_ = network_activity; | 598 network_activity_ = network_activity; |
603 host()->SetNetworkActivity(network_activity); | 599 host()->SetNetworkActivity(network_activity); |
604 } | 600 } |
605 host()->SetBufferedBytes(buffered_position + 1); | 601 host()->SetBufferedBytes(buffered_position + 1); |
606 } | 602 } |
607 | 603 |
608 } // namespace webkit_glue | 604 } // namespace webkit_glue |
OLD | NEW |