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/logging.h" | 7 #include "base/logging.h" |
8 #include "third_party/libvpx/source/libvpx/vpx/vp8dx.h" | 8 #include "third_party/libvpx/source/libvpx/vpx/vp8dx.h" |
9 | 9 |
10 namespace media { | 10 namespace media { |
(...skipping 19 matching lines...) Expand all Loading... |
30 bool Vp8Decoder::Decode(const EncodedVideoFrame& input_image, | 30 bool Vp8Decoder::Decode(const EncodedVideoFrame& input_image, |
31 I420VideoFrame* decoded_frame) { | 31 I420VideoFrame* decoded_frame) { |
32 VLOG(1) << "VP8 decode frame:" << static_cast<int>(input_image.frame_id) | 32 VLOG(1) << "VP8 decode frame:" << static_cast<int>(input_image.frame_id) |
33 << " sized:" << input_image.data.size(); | 33 << " sized:" << input_image.data.size(); |
34 | 34 |
35 if (input_image.data.empty()) return false; | 35 if (input_image.data.empty()) return false; |
36 | 36 |
37 vpx_codec_iter_t iter = NULL; | 37 vpx_codec_iter_t iter = NULL; |
38 vpx_image_t* img; | 38 vpx_image_t* img; |
39 if (vpx_codec_decode(decoder_.get(), | 39 if (vpx_codec_decode(decoder_.get(), |
40 input_image.data.data(), | 40 reinterpret_cast<const uint8*>(input_image.data.data()), |
41 static_cast<unsigned int>(input_image.data.size()), | 41 static_cast<unsigned int>(input_image.data.size()), |
42 0, | 42 0, |
43 1 /* real time*/)) { | 43 1 /* real time*/)) { |
44 VLOG(1) << "Failed to decode VP8 frame."; | 44 VLOG(1) << "Failed to decode VP8 frame."; |
45 return false; | 45 return false; |
46 } | 46 } |
47 | 47 |
48 img = vpx_codec_get_frame(decoder_.get(), &iter); | 48 img = vpx_codec_get_frame(decoder_.get(), &iter); |
49 if (img == NULL) { | 49 if (img == NULL) { |
50 VLOG(1) << "Skip rendering VP8 frame:" | 50 VLOG(1) << "Skip rendering VP8 frame:" |
(...skipping 24 matching lines...) Expand all Loading... |
75 | 75 |
76 memcpy(decoded_frame->v_plane.data, img->planes[VPX_PLANE_V], | 76 memcpy(decoded_frame->v_plane.data, img->planes[VPX_PLANE_V], |
77 decoded_frame->v_plane.length); | 77 decoded_frame->v_plane.length); |
78 | 78 |
79 return true; | 79 return true; |
80 } | 80 } |
81 | 81 |
82 } // namespace cast | 82 } // namespace cast |
83 } // namespace media | 83 } // namespace media |
84 | 84 |
OLD | NEW |