| 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/codecs/vp8/vp8_decoder.h" | 5 #include "media/cast/video_receiver/codecs/vp8/vp8_decoder.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "media/base/video_frame.h" | 10 #include "media/base/video_frame.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 vpx_codec_err_t ret = vpx_codec_dec_init(decoder_.get(), | 47 vpx_codec_err_t ret = vpx_codec_dec_init(decoder_.get(), |
| 48 vpx_codec_vp8_dx(), | 48 vpx_codec_vp8_dx(), |
| 49 &cfg, | 49 &cfg, |
| 50 flags); | 50 flags); |
| 51 if (ret != VPX_CODEC_OK) { | 51 if (ret != VPX_CODEC_OK) { |
| 52 DCHECK(false) << "vpx_codec_dec_init() failed."; | 52 DCHECK(false) << "vpx_codec_dec_init() failed."; |
| 53 decoder_.reset(); | 53 decoder_.reset(); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 bool Vp8Decoder::Decode(const transport::EncodedVideoFrame* encoded_frame, | 57 bool Vp8Decoder::Decode(const EncodedVideoFrame* encoded_frame, |
| 58 const base::TimeTicks render_time, | 58 const base::TimeTicks render_time, |
| 59 const VideoFrameDecodedCallback& frame_decoded_cb) { | 59 const VideoFrameDecodedCallback& frame_decoded_cb) { |
| 60 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::VIDEO_DECODER)); | 60 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::VIDEO_DECODER)); |
| 61 const int frame_id_int = static_cast<int>(encoded_frame->frame_id); | 61 const int frame_id_int = static_cast<int>(encoded_frame->frame_id); |
| 62 VLOG(1) << "VP8 decode frame:" << frame_id_int | 62 VLOG(1) << "VP8 decode frame:" << frame_id_int |
| 63 << " sized:" << encoded_frame->data.size(); | 63 << " sized:" << encoded_frame->data.size(); |
| 64 | 64 |
| 65 if (encoded_frame->data.empty()) return false; | 65 if (encoded_frame->data.empty()) return false; |
| 66 | 66 |
| 67 vpx_codec_iter_t iter = NULL; | 67 vpx_codec_iter_t iter = NULL; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 VLOG(1) << "Decoded frame " << frame_id_int; | 107 VLOG(1) << "Decoded frame " << frame_id_int; |
| 108 // Frame decoded - return frame to the user via callback. | 108 // Frame decoded - return frame to the user via callback. |
| 109 cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE, | 109 cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE, |
| 110 base::Bind(frame_decoded_cb, decoded_frame, render_time)); | 110 base::Bind(frame_decoded_cb, decoded_frame, render_time)); |
| 111 | 111 |
| 112 return true; | 112 return true; |
| 113 } | 113 } |
| 114 | 114 |
| 115 } // namespace cast | 115 } // namespace cast |
| 116 } // namespace media | 116 } // namespace media |
| OLD | NEW |