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