| 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/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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |