| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "media/base/decoder_buffer.h" | 11 #include "media/base/decoder_buffer.h" |
| 12 #include "media/base/demuxer_stream.h" | 12 #include "media/base/demuxer_stream.h" |
| 13 #include "media/base/filter_host.h" | 13 #include "media/base/filter_host.h" |
| 14 #include "media/base/pipeline.h" | 14 #include "media/base/pipeline.h" |
| 15 #include "media/base/pipeline_status.h" |
| 15 #include "media/base/video_decoder_config.h" | 16 #include "media/base/video_decoder_config.h" |
| 16 #include "media/ffmpeg/ffmpeg_common.h" | 17 #include "media/ffmpeg/ffmpeg_common.h" |
| 17 | 18 |
| 18 namespace media { | 19 namespace media { |
| 19 | 20 |
| 20 GpuVideoDecoder::Factories::~Factories() {} | 21 GpuVideoDecoder::Factories::~Factories() {} |
| 21 | 22 |
| 22 // Size of shared-memory segments we allocate. Since we reuse them we let them | 23 // Size of shared-memory segments we allocate. Since we reuse them we let them |
| 23 // be on the beefy side. | 24 // be on the beefy side. |
| 24 static const size_t kSharedMemorySegmentBytes = 100 << 10; | 25 static const size_t kSharedMemorySegmentBytes = 100 << 10; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 closure.Run(); | 107 closure.Run(); |
| 107 return; | 108 return; |
| 108 } | 109 } |
| 109 vda_loop_proxy_->PostTask(FROM_HERE, base::Bind( | 110 vda_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
| 110 &VideoDecodeAccelerator::Destroy, vda_)); | 111 &VideoDecodeAccelerator::Destroy, vda_)); |
| 111 vda_ = NULL; | 112 vda_ = NULL; |
| 112 closure.Run(); | 113 closure.Run(); |
| 113 } | 114 } |
| 114 | 115 |
| 115 void GpuVideoDecoder::Initialize(const scoped_refptr<DemuxerStream>& stream, | 116 void GpuVideoDecoder::Initialize(const scoped_refptr<DemuxerStream>& stream, |
| 116 const PipelineStatusCB& status_cb, | 117 const PipelineStatusCB& orig_status_cb, |
| 117 const StatisticsCB& statistics_cb) { | 118 const StatisticsCB& statistics_cb) { |
| 118 if (!gvd_loop_proxy_->BelongsToCurrentThread()) { | 119 if (!gvd_loop_proxy_->BelongsToCurrentThread()) { |
| 119 gvd_loop_proxy_->PostTask(FROM_HERE, base::Bind( | 120 gvd_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
| 120 &GpuVideoDecoder::Initialize, | 121 &GpuVideoDecoder::Initialize, |
| 121 this, stream, status_cb, statistics_cb)); | 122 this, stream, orig_status_cb, statistics_cb)); |
| 122 return; | 123 return; |
| 123 } | 124 } |
| 124 | 125 |
| 126 PipelineStatusCB status_cb = CreateUMAReportingPipelineCB( |
| 127 "Media.GpuVideoDecoderInitializeStatus", orig_status_cb); |
| 128 |
| 125 DCHECK(!demuxer_stream_); | 129 DCHECK(!demuxer_stream_); |
| 126 if (!stream) { | 130 if (!stream) { |
| 127 status_cb.Run(PIPELINE_ERROR_DECODE); | 131 status_cb.Run(PIPELINE_ERROR_DECODE); |
| 128 return; | 132 return; |
| 129 } | 133 } |
| 130 | 134 |
| 131 const VideoDecoderConfig& config = stream->video_decoder_config(); | 135 const VideoDecoderConfig& config = stream->video_decoder_config(); |
| 132 // TODO(scherkus): this check should go in Pipeline prior to creating | 136 // TODO(scherkus): this check should go in Pipeline prior to creating |
| 133 // decoder objects. | 137 // decoder objects. |
| 134 if (!config.IsValidConfig()) { | 138 if (!config.IsValidConfig()) { |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 | 539 |
| 536 error_occured_ = true; | 540 error_occured_ = true; |
| 537 | 541 |
| 538 if (!pending_read_cb_.is_null()) { | 542 if (!pending_read_cb_.is_null()) { |
| 539 base::ResetAndReturn(&pending_read_cb_).Run(kDecodeError, NULL); | 543 base::ResetAndReturn(&pending_read_cb_).Run(kDecodeError, NULL); |
| 540 return; | 544 return; |
| 541 } | 545 } |
| 542 } | 546 } |
| 543 | 547 |
| 544 } // namespace media | 548 } // namespace media |
| OLD | NEW |