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 <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1507 FFmpegDemuxerStream* audio = GetFFmpegStream(DemuxerStream::AUDIO); | 1507 FFmpegDemuxerStream* audio = GetFFmpegStream(DemuxerStream::AUDIO); |
1508 FFmpegDemuxerStream* video = GetFFmpegStream(DemuxerStream::VIDEO); | 1508 FFmpegDemuxerStream* video = GetFFmpegStream(DemuxerStream::VIDEO); |
1509 if (audio && video) { | 1509 if (audio && video) { |
1510 buffered = audio->GetBufferedRanges().IntersectionWith( | 1510 buffered = audio->GetBufferedRanges().IntersectionWith( |
1511 video->GetBufferedRanges()); | 1511 video->GetBufferedRanges()); |
1512 } else if (audio) { | 1512 } else if (audio) { |
1513 buffered = audio->GetBufferedRanges(); | 1513 buffered = audio->GetBufferedRanges(); |
1514 } else if (video) { | 1514 } else if (video) { |
1515 buffered = video->GetBufferedRanges(); | 1515 buffered = video->GetBufferedRanges(); |
1516 } | 1516 } |
1517 for (size_t i = 0; i < buffered.size(); ++i) | 1517 host_->OnBufferedTimeRangesChanged(buffered); |
1518 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i)); | |
1519 } | 1518 } |
1520 | 1519 |
1521 void FFmpegDemuxer::OnDataSourceError() { | 1520 void FFmpegDemuxer::OnDataSourceError() { |
1522 MEDIA_LOG(ERROR, media_log_) << GetDisplayName() << ": data source error"; | 1521 MEDIA_LOG(ERROR, media_log_) << GetDisplayName() << ": data source error"; |
1523 host_->OnDemuxerError(PIPELINE_ERROR_READ); | 1522 host_->OnDemuxerError(PIPELINE_ERROR_READ); |
1524 } | 1523 } |
1525 | 1524 |
1526 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { | 1525 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { |
1527 DCHECK(task_runner_->BelongsToCurrentThread()); | 1526 DCHECK(task_runner_->BelongsToCurrentThread()); |
1528 for (const auto& stream : streams_) { // |stream| is a ref to a pointer. | 1527 for (const auto& stream : streams_) { // |stream| is a ref to a pointer. |
1529 if (stream) | 1528 if (stream) |
1530 stream->SetLiveness(liveness); | 1529 stream->SetLiveness(liveness); |
1531 } | 1530 } |
1532 } | 1531 } |
1533 | 1532 |
1534 } // namespace media | 1533 } // namespace media |
OLD | NEW |