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 17 matching lines...) Expand all Loading... |
28 } | 28 } |
29 | 29 |
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 if (input_image.data.empty()) return false; | 32 if (input_image.data.empty()) return false; |
33 | 33 |
34 vpx_codec_iter_t iter = NULL; | 34 vpx_codec_iter_t iter = NULL; |
35 vpx_image_t* img; | 35 vpx_image_t* img; |
36 if (vpx_codec_decode(decoder_.get(), | 36 if (vpx_codec_decode(decoder_.get(), |
37 input_image.data.data(), | 37 input_image.data.data(), |
38 input_image.data.size(), | 38 static_cast<unsigned int>(input_image.data.size()), |
39 0, | 39 0, |
40 1 /* real time*/)) { | 40 1 /* real time*/)) { |
41 return false; | 41 return false; |
42 } | 42 } |
43 | 43 |
44 img = vpx_codec_get_frame(decoder_.get(), &iter); | 44 img = vpx_codec_get_frame(decoder_.get(), &iter); |
45 if (img == NULL) return false; | 45 if (img == NULL) return false; |
46 | 46 |
47 // Populate the decoded image. | 47 // Populate the decoded image. |
48 decoded_frame->width = img->d_w; | 48 decoded_frame->width = img->d_w; |
(...skipping 10 matching lines...) Expand all Loading... |
59 decoded_frame->v_plane.stride = img->stride[VPX_PLANE_V]; | 59 decoded_frame->v_plane.stride = img->stride[VPX_PLANE_V]; |
60 decoded_frame->v_plane.length = img->stride[VPX_PLANE_V] * img->d_h; | 60 decoded_frame->v_plane.length = img->stride[VPX_PLANE_V] * img->d_h; |
61 decoded_frame->v_plane.data = img->planes[VPX_PLANE_V]; | 61 decoded_frame->v_plane.data = img->planes[VPX_PLANE_V]; |
62 | 62 |
63 return true; | 63 return true; |
64 } | 64 } |
65 | 65 |
66 } // namespace cast | 66 } // namespace cast |
67 } // namespace media | 67 } // namespace media |
68 | 68 |
OLD | NEW |