| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 }; | 219 }; |
| 220 | 220 |
| 221 // Assigns |state_| to |state| | 221 // Assigns |state_| to |state| |
| 222 void ChangeState_Locked(State state); | 222 void ChangeState_Locked(State state); |
| 223 | 223 |
| 224 // Adds the callback to |read_cbs_| so it can be called later when we | 224 // Adds the callback to |read_cbs_| so it can be called later when we |
| 225 // have data. | 225 // have data. |
| 226 void DeferRead_Locked(const ReadCB& read_cb); | 226 void DeferRead_Locked(const ReadCB& read_cb); |
| 227 | 227 |
| 228 // Creates closures that bind ReadCBs in |read_cbs_| to data in | 228 // Creates closures that bind ReadCBs in |read_cbs_| to data in |
| 229 // |buffers_| and pops the callbacks & buffers from the respecive queues. | 229 // |buffers_| and pops the callbacks & buffers from the respective queues. |
| 230 void CreateReadDoneClosures_Locked(ClosureQueue* closures); | 230 void CreateReadDoneClosures_Locked(ClosureQueue* closures); |
| 231 | 231 |
| 232 // Gets the value to pass to the next Read() callback. Returns true if | 232 // Gets the value to pass to the next Read() callback. Returns true if |
| 233 // |status| and |buffer| should be passed to the callback. False indicates | 233 // |status| and |buffer| should be passed to the callback. False indicates |
| 234 // that |status| and |buffer| were not set and more data is needed. | 234 // that |status| and |buffer| were not set and more data is needed. |
| 235 bool GetNextBuffer_Locked(DemuxerStream::Status* status, | 235 bool GetNextBuffer_Locked(DemuxerStream::Status* status, |
| 236 scoped_refptr<StreamParserBuffer>* buffer); | 236 scoped_refptr<StreamParserBuffer>* buffer); |
| 237 | 237 |
| 238 // Specifies the type of the stream (must be AUDIO or VIDEO for now). | 238 // Specifies the type of the stream (must be AUDIO or VIDEO for now). |
| 239 Type type_; | 239 Type type_; |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 | 1009 |
| 1010 if (video_) | 1010 if (video_) |
| 1011 video_->Seek(TimeDelta()); | 1011 video_->Seek(TimeDelta()); |
| 1012 | 1012 |
| 1013 if (duration_ == TimeDelta()) | 1013 if (duration_ == TimeDelta()) |
| 1014 duration_ = kInfiniteDuration(); | 1014 duration_ = kInfiniteDuration(); |
| 1015 | 1015 |
| 1016 // The demuxer is now initialized after the |start_timestamp_| was set. | 1016 // The demuxer is now initialized after the |start_timestamp_| was set. |
| 1017 ChangeState_Locked(INITIALIZED); | 1017 ChangeState_Locked(INITIALIZED); |
| 1018 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK); | 1018 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK); |
| 1019 | |
| 1020 } | 1019 } |
| 1021 | 1020 |
| 1022 bool ChunkDemuxer::OnNewConfigs(bool has_audio, bool has_video, | 1021 bool ChunkDemuxer::OnNewConfigs(bool has_audio, bool has_video, |
| 1023 const AudioDecoderConfig& audio_config, | 1022 const AudioDecoderConfig& audio_config, |
| 1024 const VideoDecoderConfig& video_config) { | 1023 const VideoDecoderConfig& video_config) { |
| 1025 DVLOG(1) << "OnNewConfigs(" << has_audio << ", " << has_video | 1024 DVLOG(1) << "OnNewConfigs(" << has_audio << ", " << has_video |
| 1026 << ", " << audio_config.IsValidConfig() | 1025 << ", " << audio_config.IsValidConfig() |
| 1027 << ", " << video_config.IsValidConfig() << ")"; | 1026 << ", " << video_config.IsValidConfig() << ")"; |
| 1028 lock_.AssertAcquired(); | 1027 lock_.AssertAcquired(); |
| 1029 | 1028 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1189 | 1188 |
| 1190 Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges() const { | 1189 Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges() const { |
| 1191 if (audio_ && !video_) | 1190 if (audio_ && !video_) |
| 1192 return audio_->GetBufferedRanges(duration_); | 1191 return audio_->GetBufferedRanges(duration_); |
| 1193 else if (!audio_ && video_) | 1192 else if (!audio_ && video_) |
| 1194 return video_->GetBufferedRanges(duration_); | 1193 return video_->GetBufferedRanges(duration_); |
| 1195 return ComputeIntersection(); | 1194 return ComputeIntersection(); |
| 1196 } | 1195 } |
| 1197 | 1196 |
| 1198 } // namespace media | 1197 } // namespace media |
| OLD | NEW |