OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderers/default_renderer_factory.h" | 5 #include "media/renderers/default_renderer_factory.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 return audio_decoders; | 65 return audio_decoders; |
66 } | 66 } |
67 | 67 |
68 ScopedVector<VideoDecoder> DefaultRendererFactory::CreateVideoDecoders( | 68 ScopedVector<VideoDecoder> DefaultRendererFactory::CreateVideoDecoders( |
69 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, | 69 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, |
70 const RequestSurfaceCB& request_surface_cb, | 70 const RequestSurfaceCB& request_surface_cb, |
71 GpuVideoAcceleratorFactories* gpu_factories) { | 71 GpuVideoAcceleratorFactories* gpu_factories) { |
72 // Create our video decoders and renderer. | 72 // Create our video decoders and renderer. |
73 ScopedVector<VideoDecoder> video_decoders; | 73 ScopedVector<VideoDecoder> video_decoders; |
74 | 74 |
75 // Prefer an external decoder since one will only exist if it is hardware | |
76 // accelerated. | |
77 if (decoder_factory_) | |
78 decoder_factory_->CreateVideoDecoders(media_task_runner, &video_decoders); | |
79 | |
80 // |gpu_factories_| requires that its entry points be called on its | 75 // |gpu_factories_| requires that its entry points be called on its |
81 // |GetTaskRunner()|. Since |pipeline_| will own decoders created from the | 76 // |GetTaskRunner()|. Since |pipeline_| will own decoders created from the |
82 // factories, require that their message loops are identical. | 77 // factories, require that their message loops are identical. |
83 DCHECK(!gpu_factories || | 78 DCHECK(!gpu_factories || |
84 (gpu_factories->GetTaskRunner() == media_task_runner.get())); | 79 (gpu_factories->GetTaskRunner() == media_task_runner.get())); |
85 | 80 |
86 if (gpu_factories) | 81 // Prefer an external decoder since one will only exist if it is hardware |
| 82 // accelerated. |
| 83 if (gpu_factories) { |
| 84 if (decoder_factory_) { |
| 85 decoder_factory_->CreateVideoDecoders(media_task_runner, gpu_factories, |
| 86 &video_decoders); |
| 87 } |
87 video_decoders.push_back( | 88 video_decoders.push_back( |
88 new GpuVideoDecoder(gpu_factories, request_surface_cb)); | 89 new GpuVideoDecoder(gpu_factories, request_surface_cb)); |
| 90 } |
89 | 91 |
90 #if !defined(MEDIA_DISABLE_LIBVPX) | 92 #if !defined(MEDIA_DISABLE_LIBVPX) |
91 video_decoders.push_back(new VpxVideoDecoder()); | 93 video_decoders.push_back(new VpxVideoDecoder()); |
92 #endif | 94 #endif |
93 | 95 |
94 #if !defined(MEDIA_DISABLE_FFMPEG) && !defined(DISABLE_FFMPEG_VIDEO_DECODERS) | 96 #if !defined(MEDIA_DISABLE_FFMPEG) && !defined(DISABLE_FFMPEG_VIDEO_DECODERS) |
95 video_decoders.push_back(new FFmpegVideoDecoder()); | 97 video_decoders.push_back(new FFmpegVideoDecoder()); |
96 #endif | 98 #endif |
97 | 99 |
98 return video_decoders; | 100 return video_decoders; |
(...skipping 19 matching lines...) Expand all Loading... |
118 std::unique_ptr<VideoRenderer> video_renderer(new VideoRendererImpl( | 120 std::unique_ptr<VideoRenderer> video_renderer(new VideoRendererImpl( |
119 media_task_runner, worker_task_runner, video_renderer_sink, | 121 media_task_runner, worker_task_runner, video_renderer_sink, |
120 CreateVideoDecoders(media_task_runner, request_surface_cb, gpu_factories), | 122 CreateVideoDecoders(media_task_runner, request_surface_cb, gpu_factories), |
121 true, gpu_factories, media_log_)); | 123 true, gpu_factories, media_log_)); |
122 | 124 |
123 return base::WrapUnique(new RendererImpl( | 125 return base::WrapUnique(new RendererImpl( |
124 media_task_runner, std::move(audio_renderer), std::move(video_renderer))); | 126 media_task_runner, std::move(audio_renderer), std::move(video_renderer))); |
125 } | 127 } |
126 | 128 |
127 } // namespace media | 129 } // namespace media |
OLD | NEW |