| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1299 int VP8DecoderImpl::ReturnFrame(const vpx_image_t* img, | 1299 int VP8DecoderImpl::ReturnFrame(const vpx_image_t* img, |
| 1300 uint32_t timestamp, | 1300 uint32_t timestamp, |
| 1301 int64_t ntp_time_ms) { | 1301 int64_t ntp_time_ms) { |
| 1302 if (img == NULL) { | 1302 if (img == NULL) { |
| 1303 // Decoder OK and NULL image => No show frame | 1303 // Decoder OK and NULL image => No show frame |
| 1304 return WEBRTC_VIDEO_CODEC_NO_OUTPUT; | 1304 return WEBRTC_VIDEO_CODEC_NO_OUTPUT; |
| 1305 } | 1305 } |
| 1306 last_frame_width_ = img->d_w; | 1306 last_frame_width_ = img->d_w; |
| 1307 last_frame_height_ = img->d_h; | 1307 last_frame_height_ = img->d_h; |
| 1308 // Allocate memory for decoded image. | 1308 // Allocate memory for decoded image. |
| 1309 VideoFrame decoded_image(buffer_pool_.CreateBuffer(img->d_w, img->d_h), | 1309 rtc::scoped_refptr<I420Buffer> buffer = |
| 1310 timestamp, 0, kVideoRotation_0); | 1310 buffer_pool_.CreateBuffer(img->d_w, img->d_h); |
| 1311 |
| 1311 libyuv::I420Copy(img->planes[VPX_PLANE_Y], img->stride[VPX_PLANE_Y], | 1312 libyuv::I420Copy(img->planes[VPX_PLANE_Y], img->stride[VPX_PLANE_Y], |
| 1312 img->planes[VPX_PLANE_U], img->stride[VPX_PLANE_U], | 1313 img->planes[VPX_PLANE_U], img->stride[VPX_PLANE_U], |
| 1313 img->planes[VPX_PLANE_V], img->stride[VPX_PLANE_V], | 1314 img->planes[VPX_PLANE_V], img->stride[VPX_PLANE_V], |
| 1314 decoded_image.video_frame_buffer()->MutableDataY(), | 1315 buffer->MutableDataY(), buffer->StrideY(), |
| 1315 decoded_image.video_frame_buffer()->StrideY(), | 1316 buffer->MutableDataU(), buffer->StrideU(), |
| 1316 decoded_image.video_frame_buffer()->MutableDataU(), | 1317 buffer->MutableDataV(), buffer->StrideV(), |
| 1317 decoded_image.video_frame_buffer()->StrideU(), | |
| 1318 decoded_image.video_frame_buffer()->MutableDataV(), | |
| 1319 decoded_image.video_frame_buffer()->StrideV(), | |
| 1320 img->d_w, img->d_h); | 1318 img->d_w, img->d_h); |
| 1319 |
| 1320 VideoFrame decoded_image(buffer, timestamp, 0, kVideoRotation_0); |
| 1321 decoded_image.set_ntp_time_ms(ntp_time_ms); | 1321 decoded_image.set_ntp_time_ms(ntp_time_ms); |
| 1322 int ret = decode_complete_callback_->Decoded(decoded_image); | 1322 int ret = decode_complete_callback_->Decoded(decoded_image); |
| 1323 if (ret != 0) | 1323 if (ret != 0) |
| 1324 return ret; | 1324 return ret; |
| 1325 | 1325 |
| 1326 // Remember image format for later | 1326 // Remember image format for later |
| 1327 image_format_ = img->fmt; | 1327 image_format_ = img->fmt; |
| 1328 return WEBRTC_VIDEO_CODEC_OK; | 1328 return WEBRTC_VIDEO_CODEC_OK; |
| 1329 } | 1329 } |
| 1330 | 1330 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1364 return -1; | 1364 return -1; |
| 1365 } | 1365 } |
| 1366 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) != | 1366 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) != |
| 1367 VPX_CODEC_OK) { | 1367 VPX_CODEC_OK) { |
| 1368 return -1; | 1368 return -1; |
| 1369 } | 1369 } |
| 1370 return 0; | 1370 return 0; |
| 1371 } | 1371 } |
| 1372 | 1372 |
| 1373 } // namespace webrtc | 1373 } // namespace webrtc |
| OLD | NEW |