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 | 10 |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
506 | 506 |
507 if (video_) | 507 if (video_) |
508 video_->Shutdown(); | 508 video_->Shutdown(); |
509 | 509 |
510 for (TextStreamMap::iterator itr = text_stream_map_.begin(); | 510 for (TextStreamMap::iterator itr = text_stream_map_.begin(); |
511 itr != text_stream_map_.end(); ++itr) { | 511 itr != text_stream_map_.end(); ++itr) { |
512 itr->second->Shutdown(); | 512 itr->second->Shutdown(); |
513 } | 513 } |
514 } | 514 } |
515 | 515 |
516 void SourceState::SetMemoryLimits(DemuxerStream::Type type, int memory_limit) { | 516 void SourceState::SetMemoryLimits(DemuxerStream::Type type, int memory_limit) { |
wolenetz
2015/07/17 20:23:53
ISTM this method's decl and defn needs similar cha
servolk
2015/07/17 21:34:06
Done.
| |
517 switch (type) { | 517 switch (type) { |
518 case DemuxerStream::AUDIO: | 518 case DemuxerStream::AUDIO: |
519 if (audio_) | 519 if (audio_) |
520 audio_->set_memory_limit(memory_limit); | 520 audio_->SetMemoryLimit(memory_limit); |
521 break; | 521 break; |
522 case DemuxerStream::VIDEO: | 522 case DemuxerStream::VIDEO: |
523 if (video_) | 523 if (video_) |
524 video_->set_memory_limit(memory_limit); | 524 video_->SetMemoryLimit(memory_limit); |
525 break; | 525 break; |
526 case DemuxerStream::TEXT: | 526 case DemuxerStream::TEXT: |
527 for (TextStreamMap::iterator itr = text_stream_map_.begin(); | 527 for (TextStreamMap::iterator itr = text_stream_map_.begin(); |
528 itr != text_stream_map_.end(); ++itr) { | 528 itr != text_stream_map_.end(); ++itr) { |
529 itr->second->set_memory_limit(memory_limit); | 529 itr->second->SetMemoryLimit(memory_limit); |
530 } | 530 } |
531 break; | 531 break; |
532 case DemuxerStream::UNKNOWN: | 532 case DemuxerStream::UNKNOWN: |
533 case DemuxerStream::NUM_TYPES: | 533 case DemuxerStream::NUM_TYPES: |
534 NOTREACHED(); | 534 NOTREACHED(); |
535 break; | 535 break; |
536 } | 536 } |
537 } | 537 } |
538 | 538 |
539 bool SourceState::IsSeekWaitingForData() const { | 539 bool SourceState::IsSeekWaitingForData() const { |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1008 } | 1008 } |
1009 | 1009 |
1010 VideoDecoderConfig ChunkDemuxerStream::video_decoder_config() { | 1010 VideoDecoderConfig ChunkDemuxerStream::video_decoder_config() { |
1011 CHECK_EQ(type_, VIDEO); | 1011 CHECK_EQ(type_, VIDEO); |
1012 base::AutoLock auto_lock(lock_); | 1012 base::AutoLock auto_lock(lock_); |
1013 return stream_->GetCurrentVideoDecoderConfig(); | 1013 return stream_->GetCurrentVideoDecoderConfig(); |
1014 } | 1014 } |
1015 | 1015 |
1016 bool ChunkDemuxerStream::SupportsConfigChanges() { return true; } | 1016 bool ChunkDemuxerStream::SupportsConfigChanges() { return true; } |
1017 | 1017 |
1018 void ChunkDemuxerStream::SetMemoryLimit(size_t memory_limit) { | |
wolenetz
2015/07/17 20:23:53
nit: try to retain ordering of methods in impl as
servolk
2015/07/17 21:34:06
Done.
| |
1019 stream_->SetMemoryLimit(memory_limit); | |
1020 } | |
1021 | |
1018 VideoRotation ChunkDemuxerStream::video_rotation() { | 1022 VideoRotation ChunkDemuxerStream::video_rotation() { |
1019 return VIDEO_ROTATION_0; | 1023 return VIDEO_ROTATION_0; |
1020 } | 1024 } |
1021 | 1025 |
1022 TextTrackConfig ChunkDemuxerStream::text_track_config() { | 1026 TextTrackConfig ChunkDemuxerStream::text_track_config() { |
1023 CHECK_EQ(type_, TEXT); | 1027 CHECK_EQ(type_, TEXT); |
1024 base::AutoLock auto_lock(lock_); | 1028 base::AutoLock auto_lock(lock_); |
1025 return stream_->GetCurrentTextTrackConfig(); | 1029 return stream_->GetCurrentTextTrackConfig(); |
1026 } | 1030 } |
1027 | 1031 |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1580 return; | 1584 return; |
1581 | 1585 |
1582 ShutdownAllStreams(); | 1586 ShutdownAllStreams(); |
1583 | 1587 |
1584 ChangeState_Locked(SHUTDOWN); | 1588 ChangeState_Locked(SHUTDOWN); |
1585 | 1589 |
1586 if(!seek_cb_.is_null()) | 1590 if(!seek_cb_.is_null()) |
1587 base::ResetAndReturn(&seek_cb_).Run(PIPELINE_ERROR_ABORT); | 1591 base::ResetAndReturn(&seek_cb_).Run(PIPELINE_ERROR_ABORT); |
1588 } | 1592 } |
1589 | 1593 |
1590 void ChunkDemuxer::SetMemoryLimits(DemuxerStream::Type type, int memory_limit) { | 1594 void ChunkDemuxer::SetMemoryLimits(DemuxerStream::Type type, |
1595 size_t memory_limit) { | |
1591 for (SourceStateMap::iterator itr = source_state_map_.begin(); | 1596 for (SourceStateMap::iterator itr = source_state_map_.begin(); |
1592 itr != source_state_map_.end(); ++itr) { | 1597 itr != source_state_map_.end(); ++itr) { |
1593 itr->second->SetMemoryLimits(type, memory_limit); | 1598 itr->second->SetMemoryLimits(type, memory_limit); |
1594 } | 1599 } |
1595 } | 1600 } |
1596 | 1601 |
1597 void ChunkDemuxer::ChangeState_Locked(State new_state) { | 1602 void ChunkDemuxer::ChangeState_Locked(State new_state) { |
1598 lock_.AssertAcquired(); | 1603 lock_.AssertAcquired(); |
1599 DVLOG(1) << "ChunkDemuxer::ChangeState_Locked() : " | 1604 DVLOG(1) << "ChunkDemuxer::ChangeState_Locked() : " |
1600 << state_ << " -> " << new_state; | 1605 << state_ << " -> " << new_state; |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1831 } | 1836 } |
1832 | 1837 |
1833 void ChunkDemuxer::ShutdownAllStreams() { | 1838 void ChunkDemuxer::ShutdownAllStreams() { |
1834 for (SourceStateMap::iterator itr = source_state_map_.begin(); | 1839 for (SourceStateMap::iterator itr = source_state_map_.begin(); |
1835 itr != source_state_map_.end(); ++itr) { | 1840 itr != source_state_map_.end(); ++itr) { |
1836 itr->second->Shutdown(); | 1841 itr->second->Shutdown(); |
1837 } | 1842 } |
1838 } | 1843 } |
1839 | 1844 |
1840 } // namespace media | 1845 } // namespace media |
OLD | NEW |