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 "media/cast/video_receiver/video_decoder.h"
8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h"
10 #include "media/cast/video_receiver/codecs/vp8/vp8_decoder.h"
15 VideoDecoder::VideoDecoder(const VideoReceiverConfig& video_config)
16 : codec_(video_config.codec),
18 switch (video_config.codec) {
20 // Initializing to use one core.
21 vp8_decoder_.reset(new Vp8Decoder(1));
27 DCHECK(false) << "Invalid codec";
32 VideoDecoder::~VideoDecoder() {}
34 bool VideoDecoder::DecodeVideoFrame(
35 const EncodedVideoFrame* encoded_frame,
36 const base::TimeTicks render_time,
37 I420VideoFrame* video_frame) {
38 DCHECK(encoded_frame->codec == codec_) << "Invalid codec";
39 DCHECK_GT(encoded_frame->data.size(), GG_UINT64_C(0)) << "Empty video frame";
40 return vp8_decoder_->Decode(*encoded_frame, video_frame);