| 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 "webkit/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 "media/base/media_log.h" | 10 #include "media/base/media_log.h" |
| 11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
| 12 | 12 |
| 13 using WebKit::WebFrame; | 13 using WebKit::WebFrame; |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 // BufferedDataSource has an intermediate buffer, this value governs the initial | 17 // 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 | 18 // size of that buffer. It is set to 32KB because this is a typical read size |
| 19 // of FFmpeg. | 19 // of FFmpeg. |
| 20 const int kInitialReadBufferSize = 32768; | 20 const int kInitialReadBufferSize = 32768; |
| 21 | 21 |
| 22 // Number of cache misses we allow for a single Read() before signaling an | 22 // Number of cache misses we allow for a single Read() before signaling an |
| 23 // error. | 23 // error. |
| 24 const int kNumCacheMissRetries = 3; | 24 const int kNumCacheMissRetries = 3; |
| 25 | 25 |
| 26 } // namespace | 26 } // namespace |
| 27 | 27 |
| 28 namespace webkit_media { | 28 namespace content { |
| 29 | 29 |
| 30 class BufferedDataSource::ReadOperation { | 30 class BufferedDataSource::ReadOperation { |
| 31 public: | 31 public: |
| 32 ReadOperation(int64 position, int size, uint8* data, | 32 ReadOperation(int64 position, int size, uint8* data, |
| 33 const media::DataSource::ReadCB& callback); | 33 const media::DataSource::ReadCB& callback); |
| 34 ~ReadOperation(); | 34 ~ReadOperation(); |
| 35 | 35 |
| 36 // Runs |callback_| with the given |result|, deleting the operation | 36 // Runs |callback_| with the given |result|, deleting the operation |
| 37 // afterwards. | 37 // afterwards. |
| 38 static void Run(scoped_ptr<ReadOperation> read_op, int result); | 38 static void Run(scoped_ptr<ReadOperation> read_op, int result); |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 | 528 |
| 529 if (total_bytes_ == kPositionNotSpecified) | 529 if (total_bytes_ == kPositionNotSpecified) |
| 530 return; | 530 return; |
| 531 | 531 |
| 532 host()->SetTotalBytes(total_bytes_); | 532 host()->SetTotalBytes(total_bytes_); |
| 533 | 533 |
| 534 if (assume_fully_buffered_) | 534 if (assume_fully_buffered_) |
| 535 host()->AddBufferedByteRange(0, total_bytes_); | 535 host()->AddBufferedByteRange(0, total_bytes_); |
| 536 } | 536 } |
| 537 | 537 |
| 538 } // namespace webkit_media | 538 } // namespace content |
| OLD | NEW |