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 "remoting/codec/video_decoder_vpx.h" | 5 #include "remoting/codec/video_decoder_vpx.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
| 8 #include <stdint.h> |
8 | 9 |
9 #include "base/logging.h" | 10 #include "base/logging.h" |
10 #include "remoting/base/util.h" | 11 #include "remoting/base/util.h" |
11 #include "remoting/proto/video.pb.h" | 12 #include "remoting/proto/video.pb.h" |
12 #include "third_party/libyuv/include/libyuv/convert_argb.h" | 13 #include "third_party/libyuv/include/libyuv/convert_argb.h" |
13 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | 14 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
14 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | 15 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
15 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h" | 16 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h" |
16 | 17 |
17 extern "C" { | 18 extern "C" { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 scoped_ptr<VideoDecoderVpx> VideoDecoderVpx::CreateForVP9() { | 76 scoped_ptr<VideoDecoderVpx> VideoDecoderVpx::CreateForVP9() { |
76 return make_scoped_ptr(new VideoDecoderVpx(vpx_codec_vp9_dx())); | 77 return make_scoped_ptr(new VideoDecoderVpx(vpx_codec_vp9_dx())); |
77 } | 78 } |
78 | 79 |
79 VideoDecoderVpx::~VideoDecoderVpx() {} | 80 VideoDecoderVpx::~VideoDecoderVpx() {} |
80 | 81 |
81 bool VideoDecoderVpx::DecodePacket(const VideoPacket& packet, | 82 bool VideoDecoderVpx::DecodePacket(const VideoPacket& packet, |
82 webrtc::DesktopFrame* frame) { | 83 webrtc::DesktopFrame* frame) { |
83 // Pass the packet to the codec to process. | 84 // Pass the packet to the codec to process. |
84 vpx_codec_err_t ret = vpx_codec_decode( | 85 vpx_codec_err_t ret = vpx_codec_decode( |
85 codec_.get(), reinterpret_cast<const uint8*>(packet.data().data()), | 86 codec_.get(), reinterpret_cast<const uint8_t*>(packet.data().data()), |
86 packet.data().size(), nullptr, 0); | 87 packet.data().size(), nullptr, 0); |
87 if (ret != VPX_CODEC_OK) { | 88 if (ret != VPX_CODEC_OK) { |
88 const char* error = vpx_codec_error(codec_.get()); | 89 const char* error = vpx_codec_error(codec_.get()); |
89 const char* error_detail = vpx_codec_error_detail(codec_.get()); | 90 const char* error_detail = vpx_codec_error_detail(codec_.get()); |
90 LOG(ERROR) << "Decoding failed:" << (error ? error : "(NULL)") << "\n" | 91 LOG(ERROR) << "Decoding failed:" << (error ? error : "(NULL)") << "\n" |
91 << "Details: " << (error_detail ? error_detail : "(NULL)"); | 92 << "Details: " << (error_detail ? error_detail : "(NULL)"); |
92 return false; | 93 return false; |
93 } | 94 } |
94 | 95 |
95 // Fetch the decoded video frame. | 96 // Fetch the decoded video frame. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 145 |
145 vpx_codec_dec_cfg config; | 146 vpx_codec_dec_cfg config; |
146 config.w = 0; | 147 config.w = 0; |
147 config.h = 0; | 148 config.h = 0; |
148 config.threads = 2; | 149 config.threads = 2; |
149 vpx_codec_err_t ret = vpx_codec_dec_init(codec_.get(), codec, &config, 0); | 150 vpx_codec_err_t ret = vpx_codec_dec_init(codec_.get(), codec, &config, 0); |
150 CHECK_EQ(VPX_CODEC_OK, ret); | 151 CHECK_EQ(VPX_CODEC_OK, ret); |
151 } | 152 } |
152 | 153 |
153 } // namespace remoting | 154 } // namespace remoting |
OLD | NEW |