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

Side by Side Diff: media/base/pipeline.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/base/pipeline.h" 5 #include "media/base/pipeline.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 // NOTE: pipeline may be deleted at this point in time as a result of 498 // NOTE: pipeline may be deleted at this point in time as a result of
499 // executing |stop_cb_|. 499 // executing |stop_cb_|.
500 return; 500 return;
501 } 501 }
502 if (!error_cb_.is_null()) { 502 if (!error_cb_.is_null()) {
503 DCHECK_NE(status_, PIPELINE_OK); 503 DCHECK_NE(status_, PIPELINE_OK);
504 base::ResetAndReturn(&error_cb_).Run(status_); 504 base::ResetAndReturn(&error_cb_).Run(status_);
505 } 505 }
506 } 506 }
507 507
508 void Pipeline::AddBufferedTimeRange(TimeDelta start, TimeDelta end) { 508 void Pipeline::OnBufferedTimeRangesChanged(
509 const Ranges<base::TimeDelta>& ranges) {
509 DCHECK(IsRunning()); 510 DCHECK(IsRunning());
510 base::AutoLock auto_lock(lock_); 511 base::AutoLock auto_lock(lock_);
511 buffered_time_ranges_.Add(start, end); 512 buffered_time_ranges_ = ranges;
512 did_loading_progress_ = true; 513 did_loading_progress_ = true;
513 } 514 }
514 515
515 // Called from any thread. 516 // Called from any thread.
516 void Pipeline::OnUpdateStatistics(const PipelineStatistics& stats_delta) { 517 void Pipeline::OnUpdateStatistics(const PipelineStatistics& stats_delta) {
517 base::AutoLock auto_lock(lock_); 518 base::AutoLock auto_lock(lock_);
518 statistics_.audio_bytes_decoded += stats_delta.audio_bytes_decoded; 519 statistics_.audio_bytes_decoded += stats_delta.audio_bytes_decoded;
519 statistics_.video_bytes_decoded += stats_delta.video_bytes_decoded; 520 statistics_.video_bytes_decoded += stats_delta.video_bytes_decoded;
520 statistics_.video_frames_decoded += stats_delta.video_frames_decoded; 521 statistics_.video_frames_decoded += stats_delta.video_frames_decoded;
521 statistics_.video_frames_dropped += stats_delta.video_frames_dropped; 522 statistics_.video_frames_dropped += stats_delta.video_frames_dropped;
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 metadata_cb_.Run(metadata); 862 metadata_cb_.Run(metadata);
862 } 863 }
863 864
864 void Pipeline::BufferingStateChanged(BufferingState new_buffering_state) { 865 void Pipeline::BufferingStateChanged(BufferingState new_buffering_state) {
865 DVLOG(1) << __FUNCTION__ << "(" << new_buffering_state << ") "; 866 DVLOG(1) << __FUNCTION__ << "(" << new_buffering_state << ") ";
866 DCHECK(task_runner_->BelongsToCurrentThread()); 867 DCHECK(task_runner_->BelongsToCurrentThread());
867 buffering_state_cb_.Run(new_buffering_state); 868 buffering_state_cb_.Run(new_buffering_state);
868 } 869 }
869 870
870 } // namespace media 871 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698