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 "media/base/media_log.h" | 10 #include "media/base/media_log.h" |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 // All responses must be successful. Resources that are assumed to be fully | 364 // All responses must be successful. Resources that are assumed to be fully |
365 // buffered must have a known content length. | 365 // buffered must have a known content length. |
366 bool success = status == BufferedResourceLoader::kOk && | 366 bool success = status == BufferedResourceLoader::kOk && |
367 (!assume_fully_buffered_ || | 367 (!assume_fully_buffered_ || |
368 loader_->instance_size() != kPositionNotSpecified); | 368 loader_->instance_size() != kPositionNotSpecified); |
369 | 369 |
370 if (success) { | 370 if (success) { |
371 total_bytes_ = loader_->instance_size(); | 371 total_bytes_ = loader_->instance_size(); |
372 streaming_ = !assume_fully_buffered_ && | 372 streaming_ = !assume_fully_buffered_ && |
373 (total_bytes_ == kPositionNotSpecified || !loader_->range_supported()); | 373 (total_bytes_ == kPositionNotSpecified || !loader_->range_supported()); |
| 374 |
| 375 media_log_->SetDoubleProperty("total_bytes", |
| 376 static_cast<double>(total_bytes_)); |
| 377 media_log_->SetBooleanProperty("streaming", streaming_); |
374 } else { | 378 } else { |
375 loader_->Stop(); | 379 loader_->Stop(); |
376 } | 380 } |
377 | 381 |
378 // TODO(scherkus): we shouldn't have to lock to signal host(), see | 382 // TODO(scherkus): we shouldn't have to lock to signal host(), see |
379 // http://crbug.com/113712 for details. | 383 // http://crbug.com/113712 for details. |
380 base::AutoLock auto_lock(lock_); | 384 base::AutoLock auto_lock(lock_); |
381 if (stop_signal_received_) | 385 if (stop_signal_received_) |
382 return; | 386 return; |
383 | 387 |
384 if (success) | 388 if (success) { |
385 UpdateHostState_Locked(); | 389 UpdateHostState_Locked(); |
| 390 media_log_->SetBooleanProperty("single_origin", loader_->HasSingleOrigin()); |
| 391 media_log_->SetBooleanProperty("passed_cors_access_check", |
| 392 loader_->DidPassCORSAccessCheck()); |
| 393 media_log_->SetBooleanProperty("range_header_supported", |
| 394 loader_->range_supported()); |
| 395 } |
386 | 396 |
387 base::ResetAndReturn(&init_cb_).Run(success); | 397 base::ResetAndReturn(&init_cb_).Run(success); |
388 } | 398 } |
389 | 399 |
390 void BufferedDataSource::PartialReadStartCallback( | 400 void BufferedDataSource::PartialReadStartCallback( |
391 BufferedResourceLoader::Status status) { | 401 BufferedResourceLoader::Status status) { |
392 DCHECK(render_loop_->BelongsToCurrentThread()); | 402 DCHECK(render_loop_->BelongsToCurrentThread()); |
393 DCHECK(loader_.get()); | 403 DCHECK(loader_.get()); |
394 | 404 |
395 if (status == BufferedResourceLoader::kOk) { | 405 if (status == BufferedResourceLoader::kOk) { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 if (total_bytes_ == kPositionNotSpecified) | 539 if (total_bytes_ == kPositionNotSpecified) |
530 return; | 540 return; |
531 | 541 |
532 host()->SetTotalBytes(total_bytes_); | 542 host()->SetTotalBytes(total_bytes_); |
533 | 543 |
534 if (assume_fully_buffered_) | 544 if (assume_fully_buffered_) |
535 host()->AddBufferedByteRange(0, total_bytes_); | 545 host()->AddBufferedByteRange(0, total_bytes_); |
536 } | 546 } |
537 | 547 |
538 } // namespace content | 548 } // namespace content |
OLD | NEW |