| 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/filters/gpu_video_decoder.h" | 5 #include "media/filters/gpu_video_decoder.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_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // callsite to always be called with the same stat name (can't parameterize it). | 141 // callsite to always be called with the same stat name (can't parameterize it). |
| 142 static void ReportGpuVideoDecoderInitializeStatusToUMAAndRunCB( | 142 static void ReportGpuVideoDecoderInitializeStatusToUMAAndRunCB( |
| 143 const PipelineStatusCB& cb, | 143 const PipelineStatusCB& cb, |
| 144 PipelineStatus status) { | 144 PipelineStatus status) { |
| 145 UMA_HISTOGRAM_ENUMERATION( | 145 UMA_HISTOGRAM_ENUMERATION( |
| 146 "Media.GpuVideoDecoderInitializeStatus", status, PIPELINE_STATUS_MAX + 1); | 146 "Media.GpuVideoDecoderInitializeStatus", status, PIPELINE_STATUS_MAX + 1); |
| 147 cb.Run(status); | 147 cb.Run(status); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void GpuVideoDecoder::Initialize(const VideoDecoderConfig& config, | 150 void GpuVideoDecoder::Initialize(const VideoDecoderConfig& config, |
| 151 bool live_mode, | 151 bool /* low_delay */, |
| 152 const PipelineStatusCB& orig_status_cb, | 152 const PipelineStatusCB& orig_status_cb, |
| 153 const OutputCB& output_cb) { | 153 const OutputCB& output_cb) { |
| 154 DVLOG(3) << "Initialize()"; | 154 DVLOG(3) << "Initialize()"; |
| 155 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); | 155 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); |
| 156 DCHECK(config.IsValidConfig()); | 156 DCHECK(config.IsValidConfig()); |
| 157 DCHECK(!config.is_encrypted()); | 157 DCHECK(!config.is_encrypted()); |
| 158 | 158 |
| 159 PipelineStatusCB status_cb = | 159 PipelineStatusCB status_cb = |
| 160 base::Bind(&ReportGpuVideoDecoderInitializeStatusToUMAAndRunCB, | 160 base::Bind(&ReportGpuVideoDecoderInitializeStatusToUMAAndRunCB, |
| 161 BindToCurrentLoop(orig_status_cb)); | 161 BindToCurrentLoop(orig_status_cb)); |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 it->second.shm_buffer->shm->Close(); | 574 it->second.shm_buffer->shm->Close(); |
| 575 } | 575 } |
| 576 bitstream_buffers_in_decoder_.clear(); | 576 bitstream_buffers_in_decoder_.clear(); |
| 577 } | 577 } |
| 578 | 578 |
| 579 void GpuVideoDecoder::NotifyFlushDone() { | 579 void GpuVideoDecoder::NotifyFlushDone() { |
| 580 DVLOG(3) << "NotifyFlushDone()"; | 580 DVLOG(3) << "NotifyFlushDone()"; |
| 581 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); | 581 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); |
| 582 DCHECK_EQ(state_, kDrainingDecoder); | 582 DCHECK_EQ(state_, kDrainingDecoder); |
| 583 state_ = kDecoderDrained; | 583 state_ = kDecoderDrained; |
| 584 DeliverFrame(VideoFrame::CreateEOSFrame()); | |
| 585 base::ResetAndReturn(&eos_decode_cb_).Run(kOk); | 584 base::ResetAndReturn(&eos_decode_cb_).Run(kOk); |
| 586 } | 585 } |
| 587 | 586 |
| 588 void GpuVideoDecoder::NotifyResetDone() { | 587 void GpuVideoDecoder::NotifyResetDone() { |
| 589 DVLOG(3) << "NotifyResetDone()"; | 588 DVLOG(3) << "NotifyResetDone()"; |
| 590 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); | 589 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); |
| 591 DCHECK(bitstream_buffers_in_decoder_.empty()); | 590 DCHECK(bitstream_buffers_in_decoder_.empty()); |
| 592 | 591 |
| 593 // This needs to happen after the Reset() on vda_ is done to ensure pictures | 592 // This needs to happen after the Reset() on vda_ is done to ensure pictures |
| 594 // delivered during the reset can find their time data. | 593 // delivered during the reset can find their time data. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 608 DLOG(ERROR) << "VDA Error: " << error; | 607 DLOG(ERROR) << "VDA Error: " << error; |
| 609 DestroyVDA(); | 608 DestroyVDA(); |
| 610 } | 609 } |
| 611 | 610 |
| 612 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() | 611 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() |
| 613 const { | 612 const { |
| 614 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); | 613 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); |
| 615 } | 614 } |
| 616 | 615 |
| 617 } // namespace media | 616 } // namespace media |
| OLD | NEW |