| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 SetState(kStopping); | 578 SetState(kStopping); |
| 579 pending_callbacks_.reset(); | 579 pending_callbacks_.reset(); |
| 580 DoStop( | 580 DoStop( |
| 581 base::Bind(&PipelineImpl::OnStopCompleted, weak_factory_.GetWeakPtr())); | 581 base::Bind(&PipelineImpl::OnStopCompleted, weak_factory_.GetWeakPtr())); |
| 582 } | 582 } |
| 583 | 583 |
| 584 void PipelineImpl::ErrorChangedTask(PipelineStatus error) { | 584 void PipelineImpl::ErrorChangedTask(PipelineStatus error) { |
| 585 DCHECK(task_runner_->BelongsToCurrentThread()); | 585 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 586 DCHECK_NE(PIPELINE_OK, error) << "PIPELINE_OK isn't an error!"; | 586 DCHECK_NE(PIPELINE_OK, error) << "PIPELINE_OK isn't an error!"; |
| 587 | 587 |
| 588 media_log_->AddEvent(media_log_->CreatePipelineErrorEvent(error)); | 588 // Don't report pipeline error events to the media log here. The embedder will |
| 589 // log this when |error_cb_| is called. If the pipeline is already stopped or |
| 590 // stopping we also don't want to log any event. In case we are suspending or |
| 591 // suspended, the error may be recoverable, so don't propagate it now, instead |
| 592 // let the subsequent seek during resume propagate it if it's unrecoverable. |
| 589 | 593 |
| 590 if (state_ == kStopping || state_ == kStopped) | 594 if (state_ == kStopping || state_ == kStopped || state_ == kSuspending || |
| 595 state_ == kSuspended) { |
| 591 return; | 596 return; |
| 597 } |
| 592 | 598 |
| 593 SetState(kStopping); | 599 SetState(kStopping); |
| 594 pending_callbacks_.reset(); | 600 pending_callbacks_.reset(); |
| 595 status_ = error; | 601 status_ = error; |
| 596 | 602 |
| 597 DoStop( | 603 DoStop( |
| 598 base::Bind(&PipelineImpl::OnStopCompleted, weak_factory_.GetWeakPtr())); | 604 base::Bind(&PipelineImpl::OnStopCompleted, weak_factory_.GetWeakPtr())); |
| 599 } | 605 } |
| 600 | 606 |
| 601 void PipelineImpl::PlaybackRateChangedTask(double playback_rate) { | 607 void PipelineImpl::PlaybackRateChangedTask(double playback_rate) { |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 metadata_cb_.Run(metadata); | 867 metadata_cb_.Run(metadata); |
| 862 } | 868 } |
| 863 | 869 |
| 864 void PipelineImpl::BufferingStateChanged(BufferingState new_buffering_state) { | 870 void PipelineImpl::BufferingStateChanged(BufferingState new_buffering_state) { |
| 865 DVLOG(1) << __FUNCTION__ << "(" << new_buffering_state << ") "; | 871 DVLOG(1) << __FUNCTION__ << "(" << new_buffering_state << ") "; |
| 866 DCHECK(task_runner_->BelongsToCurrentThread()); | 872 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 867 buffering_state_cb_.Run(new_buffering_state); | 873 buffering_state_cb_.Run(new_buffering_state); |
| 868 } | 874 } |
| 869 | 875 |
| 870 } // namespace media | 876 } // namespace media |
| OLD | NEW |