Fix crash on app list start page contents not existing.
[chromium-blink-merge.git] / content / renderer / media / rtc_video_decoder_factory.cc
blobf59a38fa9b3def68bb53db16618a34165f595c5f
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/renderer/media/rtc_video_decoder_factory.h"
7 #include "base/location.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "content/renderer/media/rtc_video_decoder.h"
10 #include "media/filters/gpu_video_accelerator_factories.h"
12 namespace content {
14 RTCVideoDecoderFactory::RTCVideoDecoderFactory(
15 const scoped_refptr<media::GpuVideoAcceleratorFactories>& gpu_factories)
16 : gpu_factories_(gpu_factories) {
17 DVLOG(2) << "RTCVideoDecoderFactory";
20 RTCVideoDecoderFactory::~RTCVideoDecoderFactory() {
21 DVLOG(2) << "~RTCVideoDecoderFactory";
24 webrtc::VideoDecoder* RTCVideoDecoderFactory::CreateVideoDecoder(
25 webrtc::VideoCodecType type) {
26 DVLOG(2) << "CreateVideoDecoder";
27 scoped_ptr<RTCVideoDecoder> decoder =
28 RTCVideoDecoder::Create(type, gpu_factories_);
29 return decoder.release();
32 void RTCVideoDecoderFactory::DestroyVideoDecoder(
33 webrtc::VideoDecoder* decoder) {
34 DVLOG(2) << "DestroyVideoDecoder";
35 gpu_factories_->GetTaskRunner()->DeleteSoon(FROM_HERE, decoder);
38 } // namespace content