OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/filters/chunk_demuxer.h" | 5 #include "media/filters/chunk_demuxer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "media/base/audio_decoder_config.h" | 10 #include "media/base/audio_decoder_config.h" |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 // false. This indicates we have parsed enough data to complete the seek. | 692 // false. This indicates we have parsed enough data to complete the seek. |
693 if (old_seek_waits_for_data && !seek_waits_for_data_ && | 693 if (old_seek_waits_for_data && !seek_waits_for_data_ && |
694 !seek_cb_.is_null()) { | 694 !seek_cb_.is_null()) { |
695 std::swap(cb, seek_cb_); | 695 std::swap(cb, seek_cb_); |
696 } | 696 } |
697 | 697 |
698 buffered_bytes_ += length; | 698 buffered_bytes_ += length; |
699 buffered_bytes = buffered_bytes_; | 699 buffered_bytes = buffered_bytes_; |
700 } | 700 } |
701 | 701 |
702 // Notify the host of 'network activity' because we got data. | 702 // Notify the host of 'network activity' because we got data, using a bogus |
703 host_->SetBufferedBytes(buffered_bytes); | 703 // range. |
| 704 host_->AddBufferedByteRange(0, buffered_bytes); |
704 | 705 |
705 host_->SetNetworkActivity(true); | 706 host_->SetNetworkActivity(true); |
706 | 707 |
707 if (!cb.is_null()) | 708 if (!cb.is_null()) |
708 cb.Run(PIPELINE_OK); | 709 cb.Run(PIPELINE_OK); |
709 | 710 |
710 return true; | 711 return true; |
711 } | 712 } |
712 | 713 |
713 void ChunkDemuxer::Abort(const std::string& id) { | 714 void ChunkDemuxer::Abort(const std::string& id) { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 base::TimeDelta duration) { | 827 base::TimeDelta duration) { |
827 lock_.AssertAcquired(); | 828 lock_.AssertAcquired(); |
828 DCHECK_EQ(state_, INITIALIZING); | 829 DCHECK_EQ(state_, INITIALIZING); |
829 if (!success || (!audio_.get() && !video_.get())) { | 830 if (!success || (!audio_.get() && !video_.get())) { |
830 ReportError_Locked(DEMUXER_ERROR_COULD_NOT_OPEN); | 831 ReportError_Locked(DEMUXER_ERROR_COULD_NOT_OPEN); |
831 return; | 832 return; |
832 } | 833 } |
833 | 834 |
834 duration_ = duration; | 835 duration_ = duration; |
835 host_->SetDuration(duration_); | 836 host_->SetDuration(duration_); |
836 host_->SetCurrentReadPosition(0); | |
837 | 837 |
838 ChangeState_Locked(INITIALIZED); | 838 ChangeState_Locked(INITIALIZED); |
839 PipelineStatusCB cb; | 839 PipelineStatusCB cb; |
840 std::swap(cb, init_cb_); | 840 std::swap(cb, init_cb_); |
841 cb.Run(PIPELINE_OK); | 841 cb.Run(PIPELINE_OK); |
842 } | 842 } |
843 | 843 |
844 bool ChunkDemuxer::OnNewConfigs(const AudioDecoderConfig& audio_config, | 844 bool ChunkDemuxer::OnNewConfigs(const AudioDecoderConfig& audio_config, |
845 const VideoDecoderConfig& video_config) { | 845 const VideoDecoderConfig& video_config) { |
846 CHECK(audio_config.IsValidConfig() || video_config.IsValidConfig()); | 846 CHECK(audio_config.IsValidConfig() || video_config.IsValidConfig()); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 return true; | 891 return true; |
892 } | 892 } |
893 | 893 |
894 bool ChunkDemuxer::OnKeyNeeded(scoped_array<uint8> init_data, | 894 bool ChunkDemuxer::OnKeyNeeded(scoped_array<uint8> init_data, |
895 int init_data_size) { | 895 int init_data_size) { |
896 client_->KeyNeeded(init_data.Pass(), init_data_size); | 896 client_->KeyNeeded(init_data.Pass(), init_data_size); |
897 return true; | 897 return true; |
898 } | 898 } |
899 | 899 |
900 } // namespace media | 900 } // namespace media |
OLD | NEW |