| 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.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/callback.h" | 10 #include "base/callback.h" |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 | 519 |
| 520 return; | 520 return; |
| 521 } | 521 } |
| 522 | 522 |
| 523 stop_cb_ = stop_cb; | 523 stop_cb_ = stop_cb; |
| 524 | 524 |
| 525 // We may already be stopping due to a runtime error. | 525 // We may already be stopping due to a runtime error. |
| 526 if (state_ == kStopping) | 526 if (state_ == kStopping) |
| 527 return; | 527 return; |
| 528 | 528 |
| 529 PipelineStatistics stats = GetStatistics(); |
| 530 if (renderer_ && renderer_->HasVideo() && stats.video_frames_decoded > 0) |
| 531 UMA_HISTOGRAM_COUNTS("Media.DroppedFrameCount", stats.video_frames_dropped); |
| 532 |
| 529 SetState(kStopping); | 533 SetState(kStopping); |
| 530 pending_callbacks_.reset(); | 534 pending_callbacks_.reset(); |
| 531 DoStop(base::Bind(&Pipeline::OnStopCompleted, weak_factory_.GetWeakPtr())); | 535 DoStop(base::Bind(&Pipeline::OnStopCompleted, weak_factory_.GetWeakPtr())); |
| 532 } | 536 } |
| 533 | 537 |
| 534 void Pipeline::ErrorChangedTask(PipelineStatus error) { | 538 void Pipeline::ErrorChangedTask(PipelineStatus error) { |
| 535 DCHECK(task_runner_->BelongsToCurrentThread()); | 539 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 536 DCHECK_NE(PIPELINE_OK, error) << "PIPELINE_OK isn't an error!"; | 540 DCHECK_NE(PIPELINE_OK, error) << "PIPELINE_OK isn't an error!"; |
| 537 | 541 |
| 538 media_log_->AddEvent(media_log_->CreatePipelineErrorEvent(error)); | 542 media_log_->AddEvent(media_log_->CreatePipelineErrorEvent(error)); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 base::Bind(&Pipeline::GetMediaDuration, base::Unretained(this))); | 673 base::Bind(&Pipeline::GetMediaDuration, base::Unretained(this))); |
| 670 } | 674 } |
| 671 | 675 |
| 672 void Pipeline::BufferingStateChanged(BufferingState new_buffering_state) { | 676 void Pipeline::BufferingStateChanged(BufferingState new_buffering_state) { |
| 673 DVLOG(1) << __FUNCTION__ << "(" << new_buffering_state << ") "; | 677 DVLOG(1) << __FUNCTION__ << "(" << new_buffering_state << ") "; |
| 674 DCHECK(task_runner_->BelongsToCurrentThread()); | 678 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 675 buffering_state_cb_.Run(new_buffering_state); | 679 buffering_state_cb_.Run(new_buffering_state); |
| 676 } | 680 } |
| 677 | 681 |
| 678 } // namespace media | 682 } // namespace media |
| OLD | NEW |