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

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: Add unittest. 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"
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698