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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 } | 306 } |
307 } | 307 } |
308 | 308 |
309 // Have capacity? Ask for more! | 309 // Have capacity? Ask for more! |
310 if (HasAvailableCapacity() && !end_of_stream_) { | 310 if (HasAvailableCapacity() && !end_of_stream_) { |
311 demuxer_->NotifyCapacityAvailable(); | 311 demuxer_->NotifyCapacityAvailable(); |
312 } | 312 } |
313 } | 313 } |
314 | 314 |
315 bool FFmpegDemuxerStream::HasAvailableCapacity() { | 315 bool FFmpegDemuxerStream::HasAvailableCapacity() { |
316 // TODO(scherkus): Remove early return and reenable time-based capacity | 316 // TODO(scherkus): Remove this return and reenable time-based capacity |
317 // after our data sources support canceling/concurrent reads, see | 317 // after our data sources support canceling/concurrent reads, see |
318 // http://crbug.com/165762 for details. | 318 // http://crbug.com/165762 for details. |
| 319 #if 1 |
319 return !read_cb_.is_null(); | 320 return !read_cb_.is_null(); |
320 | 321 #else |
321 // Try to have one second's worth of encoded data per stream. | 322 // Try to have one second's worth of encoded data per stream. |
322 const base::TimeDelta kCapacity = base::TimeDelta::FromSeconds(1); | 323 const base::TimeDelta kCapacity = base::TimeDelta::FromSeconds(1); |
323 return buffer_queue_.IsEmpty() || buffer_queue_.Duration() < kCapacity; | 324 return buffer_queue_.IsEmpty() || buffer_queue_.Duration() < kCapacity; |
| 325 #endif |
324 } | 326 } |
325 | 327 |
326 size_t FFmpegDemuxerStream::MemoryUsage() const { | 328 size_t FFmpegDemuxerStream::MemoryUsage() const { |
327 return buffer_queue_.data_size(); | 329 return buffer_queue_.data_size(); |
328 } | 330 } |
329 | 331 |
330 TextKind FFmpegDemuxerStream::GetTextKind() const { | 332 TextKind FFmpegDemuxerStream::GetTextKind() const { |
331 DCHECK_EQ(type_, DemuxerStream::TEXT); | 333 DCHECK_EQ(type_, DemuxerStream::TEXT); |
332 | 334 |
333 if (stream_->disposition & AV_DISPOSITION_CAPTIONS) | 335 if (stream_->disposition & AV_DISPOSITION_CAPTIONS) |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 } | 976 } |
975 for (size_t i = 0; i < buffered.size(); ++i) | 977 for (size_t i = 0; i < buffered.size(); ++i) |
976 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i)); | 978 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i)); |
977 } | 979 } |
978 | 980 |
979 void FFmpegDemuxer::OnDataSourceError() { | 981 void FFmpegDemuxer::OnDataSourceError() { |
980 host_->OnDemuxerError(PIPELINE_ERROR_READ); | 982 host_->OnDemuxerError(PIPELINE_ERROR_READ); |
981 } | 983 } |
982 | 984 |
983 } // namespace media | 985 } // namespace media |
OLD | NEW |