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

Side by Side Diff: media/base/pipeline_impl.cc

Issue 2269313002: Fix DCHECK when track status changes in non-playing state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed one more DCHECK + added a unit test Created 4 years, 3 months 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
« no previous file with comments | « no previous file | media/renderers/renderer_impl.cc » ('j') | media/renderers/renderer_impl.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_impl.h" 5 #include "media/base/pipeline_impl.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 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 const std::vector<MediaTrack::Id>& enabledTrackIds) { 576 const std::vector<MediaTrack::Id>& enabledTrackIds) {
577 DCHECK(media_task_runner_->BelongsToCurrentThread()); 577 DCHECK(media_task_runner_->BelongsToCurrentThread());
578 578
579 // Track status notifications might be delivered asynchronously. If we receive 579 // Track status notifications might be delivered asynchronously. If we receive
580 // a notification when pipeline is stopped/shut down, it's safe to ignore it. 580 // a notification when pipeline is stopped/shut down, it's safe to ignore it.
581 if (state_ == kStopping || state_ == kStopped) { 581 if (state_ == kStopping || state_ == kStopped) {
582 return; 582 return;
583 } 583 }
584 584
585 DCHECK(demuxer_); 585 DCHECK(demuxer_);
586 DCHECK(shared_state_.renderer); 586 DCHECK(shared_state_.renderer || (state_ != kPlaying));
587 587
588 base::TimeDelta currTime = (state_ == kPlaying) 588 base::TimeDelta currTime = (state_ == kPlaying)
589 ? shared_state_.renderer->GetMediaTime() 589 ? shared_state_.renderer->GetMediaTime()
590 : demuxer_->GetStartTime(); 590 : demuxer_->GetStartTime();
591 demuxer_->OnEnabledAudioTracksChanged(enabledTrackIds, currTime); 591 demuxer_->OnEnabledAudioTracksChanged(enabledTrackIds, currTime);
592 } 592 }
593 593
594 void PipelineImpl::RendererWrapper::OnSelectedVideoTrackChanged( 594 void PipelineImpl::RendererWrapper::OnSelectedVideoTrackChanged(
595 const std::vector<MediaTrack::Id>& selectedTrackId) { 595 const std::vector<MediaTrack::Id>& selectedTrackId) {
596 DCHECK(media_task_runner_->BelongsToCurrentThread()); 596 DCHECK(media_task_runner_->BelongsToCurrentThread());
597 597
598 // Track status notifications might be delivered asynchronously. If we receive 598 // Track status notifications might be delivered asynchronously. If we receive
599 // a notification when pipeline is stopped/shut down, it's safe to ignore it. 599 // a notification when pipeline is stopped/shut down, it's safe to ignore it.
600 if (state_ == kStopping || state_ == kStopped) { 600 if (state_ == kStopping || state_ == kStopped) {
601 return; 601 return;
602 } 602 }
603 603
604 DCHECK(demuxer_); 604 DCHECK(demuxer_);
605 DCHECK(shared_state_.renderer); 605 DCHECK(shared_state_.renderer || (state_ != kPlaying));
606 606
607 base::TimeDelta currTime = (state_ == kPlaying) 607 base::TimeDelta currTime = (state_ == kPlaying)
608 ? shared_state_.renderer->GetMediaTime() 608 ? shared_state_.renderer->GetMediaTime()
609 : demuxer_->GetStartTime(); 609 : demuxer_->GetStartTime();
610 demuxer_->OnSelectedVideoTrackChanged(selectedTrackId, currTime); 610 demuxer_->OnSelectedVideoTrackChanged(selectedTrackId, currTime);
611 } 611 }
612 612
613 void PipelineImpl::RendererWrapper::OnStatisticsUpdate( 613 void PipelineImpl::RendererWrapper::OnStatisticsUpdate(
614 const PipelineStatistics& stats) { 614 const PipelineStatistics& stats) {
615 DVLOG(3) << __func__; 615 DVLOG(3) << __func__;
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 void PipelineImpl::OnSuspendDone() { 1235 void PipelineImpl::OnSuspendDone() {
1236 DVLOG(3) << __func__; 1236 DVLOG(3) << __func__;
1237 DCHECK(thread_checker_.CalledOnValidThread()); 1237 DCHECK(thread_checker_.CalledOnValidThread());
1238 DCHECK(IsRunning()); 1238 DCHECK(IsRunning());
1239 1239
1240 DCHECK(!suspend_cb_.is_null()); 1240 DCHECK(!suspend_cb_.is_null());
1241 base::ResetAndReturn(&suspend_cb_).Run(PIPELINE_OK); 1241 base::ResetAndReturn(&suspend_cb_).Run(PIPELINE_OK);
1242 } 1242 }
1243 1243
1244 } // namespace media 1244 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/renderers/renderer_impl.cc » ('j') | media/renderers/renderer_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698