OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "media/blink/resource_multibuffer_data_provider.h" | 5 #include "media/blink/resource_multibuffer_data_provider.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 int64_t total_encoded_data_length) { | 395 int64_t total_encoded_data_length) { |
396 DVLOG(1) << "didFinishLoading"; | 396 DVLOG(1) << "didFinishLoading"; |
397 DCHECK(active_loader_.get()); | 397 DCHECK(active_loader_.get()); |
398 DCHECK(!Available()); | 398 DCHECK(!Available()); |
399 | 399 |
400 // We're done with the loader. | 400 // We're done with the loader. |
401 active_loader_.reset(); | 401 active_loader_.reset(); |
402 | 402 |
403 // If we didn't know the |instance_size_| we do now. | 403 // If we didn't know the |instance_size_| we do now. |
404 int64_t size = byte_pos(); | 404 int64_t size = byte_pos(); |
405 if (!fifo_.empty()) | |
406 size += fifo_.back()->data_size(); | |
407 | 405 |
408 // This request reports something smaller than what we've seen in the past, | 406 // This request reports something smaller than what we've seen in the past, |
409 // Maybe it's transient error? | 407 // Maybe it's transient error? |
410 if (url_data_->length() != kPositionNotSpecified && | 408 if (url_data_->length() != kPositionNotSpecified && |
411 size < url_data_->length()) { | 409 size < url_data_->length()) { |
412 if (retries_ < kMaxRetries) { | 410 if (retries_ < kMaxRetries) { |
413 DVLOG(1) << " Partial data received.... @ pos = " << size; | 411 DVLOG(1) << " Partial data received.... @ pos = " << size; |
414 retries_++; | 412 retries_++; |
415 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 413 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
416 FROM_HERE, base::Bind(&ResourceMultiBufferDataProvider::Start, | 414 FROM_HERE, base::Bind(&ResourceMultiBufferDataProvider::Start, |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 } | 526 } |
529 | 527 |
530 if (byte_pos() != first_byte_position) { | 528 if (byte_pos() != first_byte_position) { |
531 return false; | 529 return false; |
532 } | 530 } |
533 | 531 |
534 return true; | 532 return true; |
535 } | 533 } |
536 | 534 |
537 } // namespace media | 535 } // namespace media |
OLD | NEW |