Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: content/renderer/media/buffered_data_source.cc

Issue 224093011: Move DataSourceHost to BufferedDataSourceHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
scherkus (not reviewing) 2014/04/03 21:59:37 is this because you removed the kHttpScheme consta
sandersd (OOO until July 31) 2014/04/04 23:48:41 Yes, but I removed them because of a link error.
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.
20 const int kInitialReadBufferSize = 32768; 21 const int kInitialReadBufferSize = 32768;
21 22
22 // Number of cache misses we allow for a single Read() before signaling an 23 // Number of cache misses we allow for a single Read() before signaling an
23 // error. 24 // error.
24 const int kNumCacheMissRetries = 3; 25 const int kNumCacheMissRetries = 3;
25 26
26 } // namespace 27 } // namespace
27 28
28 namespace content { 29 namespace content {
29 30
31 BufferedDataSourceHost::~BufferedDataSourceHost() {}
32
30 class BufferedDataSource::ReadOperation { 33 class BufferedDataSource::ReadOperation {
31 public: 34 public:
32 ReadOperation(int64 position, int size, uint8* data, 35 ReadOperation(int64 position, int size, uint8* data,
33 const media::DataSource::ReadCB& callback); 36 const media::DataSource::ReadCB& callback);
34 ~ReadOperation(); 37 ~ReadOperation();
35 38
36 // Runs |callback_| with the given |result|, deleting the operation 39 // Runs |callback_| with the given |result|, deleting the operation
37 // afterwards. 40 // afterwards.
38 static void Run(scoped_ptr<ReadOperation> read_op, int result); 41 static void Run(scoped_ptr<ReadOperation> read_op, int result);
39 42
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // static 77 // static
75 void BufferedDataSource::ReadOperation::Run( 78 void BufferedDataSource::ReadOperation::Run(
76 scoped_ptr<ReadOperation> read_op, int result) { 79 scoped_ptr<ReadOperation> read_op, int result) {
77 base::ResetAndReturn(&read_op->callback_).Run(result); 80 base::ResetAndReturn(&read_op->callback_).Run(result);
78 } 81 }
79 82
80 BufferedDataSource::BufferedDataSource( 83 BufferedDataSource::BufferedDataSource(
81 const scoped_refptr<base::MessageLoopProxy>& render_loop, 84 const scoped_refptr<base::MessageLoopProxy>& render_loop,
82 WebFrame* frame, 85 WebFrame* frame,
83 media::MediaLog* media_log, 86 media::MediaLog* media_log,
84 media::DataSourceHost* host, 87 BufferedDataSourceHost* host,
85 const DownloadingCB& downloading_cb) 88 const DownloadingCB& downloading_cb)
86 : cors_mode_(BufferedResourceLoader::kUnspecified), 89 : cors_mode_(BufferedResourceLoader::kUnspecified),
87 total_bytes_(kPositionNotSpecified), 90 total_bytes_(kPositionNotSpecified),
88 assume_fully_buffered_(false), 91 assume_fully_buffered_(false),
89 streaming_(false), 92 streaming_(false),
90 frame_(frame), 93 frame_(frame),
91 intermediate_read_buffer_(new uint8[kInitialReadBufferSize]), 94 intermediate_read_buffer_(new uint8[kInitialReadBufferSize]),
92 intermediate_read_buffer_size_(kInitialReadBufferSize), 95 intermediate_read_buffer_size_(kInitialReadBufferSize),
93 render_loop_(render_loop), 96 render_loop_(render_loop),
94 stop_signal_received_(false), 97 stop_signal_received_(false),
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 return; 533 return;
531 } 534 }
532 535
533 // If media is currently playing or the page indicated preload=auto, 536 // If media is currently playing or the page indicated preload=auto,
534 // use threshold strategy to enable/disable deferring when the buffer 537 // use threshold strategy to enable/disable deferring when the buffer
535 // is full/depleted. 538 // is full/depleted.
536 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer); 539 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer);
537 } 540 }
538 541
539 } // namespace content 542 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698