Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: media/filters/ffmpeg_demuxer.cc

Issue 1526303004: Fix buffered range updates in media::Pipeline (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added unit test Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 FFmpegDemuxerStream* audio = GetFFmpegStream(DemuxerStream::AUDIO); 1512 FFmpegDemuxerStream* audio = GetFFmpegStream(DemuxerStream::AUDIO);
1513 FFmpegDemuxerStream* video = GetFFmpegStream(DemuxerStream::VIDEO); 1513 FFmpegDemuxerStream* video = GetFFmpegStream(DemuxerStream::VIDEO);
1514 if (audio && video) { 1514 if (audio && video) {
1515 buffered = audio->GetBufferedRanges().IntersectionWith( 1515 buffered = audio->GetBufferedRanges().IntersectionWith(
1516 video->GetBufferedRanges()); 1516 video->GetBufferedRanges());
1517 } else if (audio) { 1517 } else if (audio) {
1518 buffered = audio->GetBufferedRanges(); 1518 buffered = audio->GetBufferedRanges();
1519 } else if (video) { 1519 } else if (video) {
1520 buffered = video->GetBufferedRanges(); 1520 buffered = video->GetBufferedRanges();
1521 } 1521 }
1522 for (size_t i = 0; i < buffered.size(); ++i) 1522 host_->OnBufferedTimeRangesChanged(buffered);
1523 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i));
1524 } 1523 }
1525 1524
1526 void FFmpegDemuxer::OnDataSourceError() { 1525 void FFmpegDemuxer::OnDataSourceError() {
1527 MEDIA_LOG(ERROR, media_log_) << GetDisplayName() << ": data source error"; 1526 MEDIA_LOG(ERROR, media_log_) << GetDisplayName() << ": data source error";
1528 host_->OnDemuxerError(PIPELINE_ERROR_READ); 1527 host_->OnDemuxerError(PIPELINE_ERROR_READ);
1529 } 1528 }
1530 1529
1531 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { 1530 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) {
1532 DCHECK(task_runner_->BelongsToCurrentThread()); 1531 DCHECK(task_runner_->BelongsToCurrentThread());
1533 for (const auto& stream : streams_) { // |stream| is a ref to a pointer. 1532 for (const auto& stream : streams_) { // |stream| is a ref to a pointer.
1534 if (stream) 1533 if (stream)
1535 stream->SetLiveness(liveness); 1534 stream->SetLiveness(liveness);
1536 } 1535 }
1537 } 1536 }
1538 1537
1539 } // namespace media 1538 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698