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/ffmpeg_demuxer.h" | 5 #include "media/filters/ffmpeg_demuxer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 } | 772 } |
773 } | 773 } |
774 | 774 |
775 // Have capacity? Ask for more! | 775 // Have capacity? Ask for more! |
776 if (HasAvailableCapacity() && !end_of_stream_) { | 776 if (HasAvailableCapacity() && !end_of_stream_) { |
777 demuxer_->NotifyCapacityAvailable(); | 777 demuxer_->NotifyCapacityAvailable(); |
778 } | 778 } |
779 } | 779 } |
780 | 780 |
781 bool FFmpegDemuxerStream::HasAvailableCapacity() { | 781 bool FFmpegDemuxerStream::HasAvailableCapacity() { |
782 // Try to have two second's worth of encoded data per stream. | 782 // TODO(scherkus): Remove this return and reenable time-based capacity |
783 const base::TimeDelta kCapacity = base::TimeDelta::FromSeconds(2); | 783 // after our data sources support canceling/concurrent reads, see |
| 784 // http://crbug.com/165762 for details. |
| 785 #if 1 |
| 786 return !read_cb_.is_null(); |
| 787 #else |
| 788 // Try to have one second's worth of encoded data per stream. |
| 789 const base::TimeDelta kCapacity = base::TimeDelta::FromSeconds(1); |
784 return buffer_queue_.IsEmpty() || buffer_queue_.Duration() < kCapacity; | 790 return buffer_queue_.IsEmpty() || buffer_queue_.Duration() < kCapacity; |
| 791 #endif |
785 } | 792 } |
786 | 793 |
787 size_t FFmpegDemuxerStream::MemoryUsage() const { | 794 size_t FFmpegDemuxerStream::MemoryUsage() const { |
788 return buffer_queue_.data_size(); | 795 return buffer_queue_.data_size(); |
789 } | 796 } |
790 | 797 |
791 TextKind FFmpegDemuxerStream::GetTextKind() const { | 798 TextKind FFmpegDemuxerStream::GetTextKind() const { |
792 DCHECK_EQ(type_, DemuxerStream::TEXT); | 799 DCHECK_EQ(type_, DemuxerStream::TEXT); |
793 | 800 |
794 if (stream_->disposition & AV_DISPOSITION_CAPTIONS) | 801 if (stream_->disposition & AV_DISPOSITION_CAPTIONS) |
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1832 | 1839 |
1833 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { | 1840 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { |
1834 DCHECK(task_runner_->BelongsToCurrentThread()); | 1841 DCHECK(task_runner_->BelongsToCurrentThread()); |
1835 for (const auto& stream : streams_) { | 1842 for (const auto& stream : streams_) { |
1836 if (stream) | 1843 if (stream) |
1837 stream->SetLiveness(liveness); | 1844 stream->SetLiveness(liveness); |
1838 } | 1845 } |
1839 } | 1846 } |
1840 | 1847 |
1841 } // namespace media | 1848 } // namespace media |
OLD | NEW |