| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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/cast/video_receiver/video_decoder.h" | 5 #include "media/cast/video_receiver/video_decoder.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 10 #include "media/cast/video_receiver/codecs/vp8/vp8_decoder.h" | 12 #include "media/cast/video_receiver/codecs/vp8/vp8_decoder.h" |
| 11 | 13 |
| 12 namespace media { | 14 namespace media { |
| 13 namespace cast { | 15 namespace cast { |
| 14 | 16 |
| 15 VideoDecoder::VideoDecoder(const VideoReceiverConfig& video_config, | 17 VideoDecoder::VideoDecoder(const VideoReceiverConfig& video_config, |
| 16 scoped_refptr<CastEnvironment> cast_environment) | 18 scoped_refptr<CastEnvironment> cast_environment) |
| 17 : codec_(video_config.codec), vp8_decoder_() { | 19 : codec_(video_config.codec), vp8_decoder_() { |
| 18 switch (video_config.codec) { | 20 switch (video_config.codec) { |
| 19 case transport::kVp8: | 21 case transport::kVp8: |
| 20 vp8_decoder_.reset(new Vp8Decoder(cast_environment)); | 22 vp8_decoder_.reset(new Vp8Decoder(cast_environment)); |
| 21 break; | 23 break; |
| 22 case transport::kH264: | 24 case transport::kH264: |
| 23 NOTIMPLEMENTED(); | 25 NOTIMPLEMENTED(); |
| 24 break; | 26 break; |
| 25 } | 27 } |
| 26 } | 28 } |
| 27 | 29 |
| 28 VideoDecoder::~VideoDecoder() {} | 30 VideoDecoder::~VideoDecoder() {} |
| 29 | 31 |
| 30 bool VideoDecoder::DecodeVideoFrame( | 32 bool VideoDecoder::DecodeVideoFrame( |
| 31 const transport::EncodedVideoFrame* encoded_frame, | 33 const transport::EncodedVideoFrame* encoded_frame, |
| 32 const base::TimeTicks render_time, | 34 const base::TimeTicks render_time, |
| 33 const VideoFrameDecodedCallback& frame_decoded_cb) { | 35 const VideoFrameDecodedCallback& frame_decoded_cb) { |
| 34 DCHECK(encoded_frame->codec == codec_) << "Invalid codec"; | 36 DCHECK(encoded_frame->codec == codec_) << "Invalid codec"; |
| 35 DCHECK_GT(encoded_frame->data.size(), GG_UINT64_C(0)) << "Empty video frame"; | 37 DCHECK_GT(encoded_frame->data.size(), UINT64_C(0)) << "Empty video frame"; |
| 36 return vp8_decoder_->Decode(encoded_frame, render_time, frame_decoded_cb); | 38 return vp8_decoder_->Decode(encoded_frame, render_time, frame_decoded_cb); |
| 37 } | 39 } |
| 38 | 40 |
| 39 } // namespace cast | 41 } // namespace cast |
| 40 } // namespace media | 42 } // namespace media |
| OLD | NEW |