| 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 <limits> | 8 #include <limits> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 void ChunkDemuxerStream::set_enabled(bool enabled, base::TimeDelta timestamp) { | 293 void ChunkDemuxerStream::set_enabled(bool enabled, base::TimeDelta timestamp) { |
| 294 base::AutoLock auto_lock(lock_); | 294 base::AutoLock auto_lock(lock_); |
| 295 | 295 |
| 296 if (enabled == is_enabled_) | 296 if (enabled == is_enabled_) |
| 297 return; | 297 return; |
| 298 | 298 |
| 299 is_enabled_ = enabled; | 299 is_enabled_ = enabled; |
| 300 if (enabled) { | 300 if (enabled) { |
| 301 DCHECK(stream_); | 301 DCHECK(stream_); |
| 302 stream_->Seek(timestamp); | 302 stream_->Seek(timestamp); |
| 303 if (!stream_restarted_cb_.is_null()) | |
| 304 stream_restarted_cb_.Run(this, timestamp); | |
| 305 } else if (!read_cb_.is_null()) { | 303 } else if (!read_cb_.is_null()) { |
| 306 DVLOG(1) << "Read from disabled stream, returning EOS"; | 304 DVLOG(1) << "Read from disabled stream, returning EOS"; |
| 307 base::ResetAndReturn(&read_cb_).Run(kOk, | 305 base::ResetAndReturn(&read_cb_).Run(kOk, |
| 308 StreamParserBuffer::CreateEOSBuffer()); | 306 StreamParserBuffer::CreateEOSBuffer()); |
| 309 } | 307 } |
| 308 if (!stream_status_change_cb_.is_null()) |
| 309 stream_status_change_cb_.Run(is_enabled_, timestamp); |
| 310 } | 310 } |
| 311 | 311 |
| 312 void ChunkDemuxerStream::SetStreamRestartedCB(const StreamRestartedCB& cb) { | 312 void ChunkDemuxerStream::SetStreamStatusChangeCB( |
| 313 const StreamStatusChangeCB& cb) { |
| 313 DCHECK(!cb.is_null()); | 314 DCHECK(!cb.is_null()); |
| 314 stream_restarted_cb_ = BindToCurrentLoop(cb); | 315 stream_status_change_cb_ = BindToCurrentLoop(cb); |
| 315 } | 316 } |
| 316 | 317 |
| 317 TextTrackConfig ChunkDemuxerStream::text_track_config() { | 318 TextTrackConfig ChunkDemuxerStream::text_track_config() { |
| 318 CHECK_EQ(type_, TEXT); | 319 CHECK_EQ(type_, TEXT); |
| 319 base::AutoLock auto_lock(lock_); | 320 base::AutoLock auto_lock(lock_); |
| 320 return stream_->GetCurrentTextTrackConfig(); | 321 return stream_->GetCurrentTextTrackConfig(); |
| 321 } | 322 } |
| 322 | 323 |
| 323 void ChunkDemuxerStream::SetStreamMemoryLimit(size_t memory_limit) { | 324 void ChunkDemuxerStream::SetStreamMemoryLimit(size_t memory_limit) { |
| 324 stream_->set_memory_limit(memory_limit); | 325 stream_->set_memory_limit(memory_limit); |
| (...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1259 } | 1260 } |
| 1260 | 1261 |
| 1261 void ChunkDemuxer::ShutdownAllStreams() { | 1262 void ChunkDemuxer::ShutdownAllStreams() { |
| 1262 for (MediaSourceStateMap::iterator itr = source_state_map_.begin(); | 1263 for (MediaSourceStateMap::iterator itr = source_state_map_.begin(); |
| 1263 itr != source_state_map_.end(); ++itr) { | 1264 itr != source_state_map_.end(); ++itr) { |
| 1264 itr->second->Shutdown(); | 1265 itr->second->Shutdown(); |
| 1265 } | 1266 } |
| 1266 } | 1267 } |
| 1267 | 1268 |
| 1268 } // namespace media | 1269 } // namespace media |
| OLD | NEW |