Chromium Code Reviews| Index: media/filters/gpu_video_decoder.cc |
| diff --git a/media/filters/gpu_video_decoder.cc b/media/filters/gpu_video_decoder.cc |
| index 07f9bced88703e53d55238246bfcd5f0a93167cc..acd01ddff4f204cac4ac792a2e7a45782812c7ad 100644 |
| --- a/media/filters/gpu_video_decoder.cc |
| +++ b/media/filters/gpu_video_decoder.cc |
| @@ -217,47 +217,48 @@ void GpuVideoDecoder::Stop(const base::Closure& closure) { |
| BindToCurrentLoop(closure).Run(); |
| } |
| +static bool IsCodedSizeSupported(const gfx::Size& coded_size) { |
| + // Only non-Windows, Ivy Bridge+ platforms can support more than 1920x1080. |
| + // We test against 1088 to account for 16x16 macroblocks. |
| + if (coded_size.width() <= 1920 && coded_size.height() <= 1088) |
| + return true; |
| + |
| + base::CPU cpu; |
| + bool hw_large_video_support = |
| + (cpu.vendor_name() == "GenuineIntel") && cpu.model() >= 58; |
| + bool os_large_video_support = true; |
| +#if defined(OS_WIN) |
| + os_large_video_support = false; |
| +#endif |
| + return os_large_video_support && hw_large_video_support; |
| +} |
| + |
| void GpuVideoDecoder::Initialize(DemuxerStream* stream, |
| const PipelineStatusCB& orig_status_cb, |
| const StatisticsCB& statistics_cb) { |
| DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
| + DCHECK(stream); |
| + |
| weak_this_ = weak_factory_.GetWeakPtr(); |
| PipelineStatusCB status_cb = CreateUMAReportingPipelineCB( |
| "Media.GpuVideoDecoderInitializeStatus", |
| BindToCurrentLoop(orig_status_cb)); |
| - DCHECK(!demuxer_stream_); |
| - if (!stream) { |
| - status_cb.Run(PIPELINE_ERROR_DECODE); |
| + if (demuxer_stream_) { |
|
scherkus (not reviewing)
2013/04/26 01:53:25
OOC once we move DemuxerStream out of video decode
xhwang
2013/04/26 18:08:01
That's a good point. Thanks for pointing it out. W
|
| + // TODO(xhwang): Make GpuVideoDecoder reinitializable. |
| + // See http://crbug.com/233608 |
| + DVLOG(1) << "GpuVideoDecoder reinitialization not supported."; |
| + status_cb.Run(DECODER_ERROR_NOT_SUPPORTED); |
| return; |
| } |
| - // TODO(scherkus): this check should go in Pipeline prior to creating |
| - // decoder objects. |
| const VideoDecoderConfig& config = stream->video_decoder_config(); |
| - if (!config.IsValidConfig() || config.is_encrypted()) { |
| - DLOG(ERROR) << "Unsupported video stream - " |
| - << config.AsHumanReadableString(); |
| - status_cb.Run(PIPELINE_ERROR_DECODE); |
| - return; |
| - } |
| + DCHECK(config.IsValidConfig() && !config.is_encrypted()); |
|
scherkus (not reviewing)
2013/04/26 01:53:25
nit: split DCHECKs so we know which one failed
xhwang
2013/04/26 18:08:01
Done.
|
| - // Only non-Windows, Ivy Bridge+ platforms can support more than 1920x1080. |
| - // We test against 1088 to account for 16x16 macroblocks. |
| - if (config.coded_size().width() > 1920 || |
| - config.coded_size().height() > 1088) { |
| - base::CPU cpu; |
| - bool hw_large_video_support = |
| - cpu.vendor_name() == "GenuineIntel" && cpu.model() >= 58; |
| - bool os_large_video_support = true; |
| -#if defined(OS_WIN) |
| - os_large_video_support = false; |
| -#endif |
| - if (!(os_large_video_support && hw_large_video_support)) { |
| - status_cb.Run(DECODER_ERROR_NOT_SUPPORTED); |
| - return; |
| - } |
| + if (!IsCodedSizeSupported(config.coded_size())) { |
| + status_cb.Run(DECODER_ERROR_NOT_SUPPORTED); |
| + return; |
| } |
| client_proxy_ = new VDAClientProxy(this); |