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 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 int VP8DecoderImpl::ReturnFrame(const vpx_image_t* img, | 1339 int VP8DecoderImpl::ReturnFrame(const vpx_image_t* img, |
1340 uint32_t timestamp, | 1340 uint32_t timestamp, |
1341 int64_t ntp_time_ms) { | 1341 int64_t ntp_time_ms) { |
1342 if (img == NULL) { | 1342 if (img == NULL) { |
1343 // Decoder OK and NULL image => No show frame | 1343 // Decoder OK and NULL image => No show frame |
1344 return WEBRTC_VIDEO_CODEC_NO_OUTPUT; | 1344 return WEBRTC_VIDEO_CODEC_NO_OUTPUT; |
1345 } | 1345 } |
1346 last_frame_width_ = img->d_w; | 1346 last_frame_width_ = img->d_w; |
1347 last_frame_height_ = img->d_h; | 1347 last_frame_height_ = img->d_h; |
1348 // Allocate memory for decoded image. | 1348 // Allocate memory for decoded image. |
1349 VideoFrame decoded_image(buffer_pool_.CreateBuffer(img->d_w, img->d_h), | 1349 rtc::scoped_refptr<I420Buffer> buffer = |
1350 timestamp, 0, kVideoRotation_0); | 1350 buffer_pool_.CreateBuffer(img->d_w, img->d_h); |
| 1351 |
1351 libyuv::I420Copy(img->planes[VPX_PLANE_Y], img->stride[VPX_PLANE_Y], | 1352 libyuv::I420Copy(img->planes[VPX_PLANE_Y], img->stride[VPX_PLANE_Y], |
1352 img->planes[VPX_PLANE_U], img->stride[VPX_PLANE_U], | 1353 img->planes[VPX_PLANE_U], img->stride[VPX_PLANE_U], |
1353 img->planes[VPX_PLANE_V], img->stride[VPX_PLANE_V], | 1354 img->planes[VPX_PLANE_V], img->stride[VPX_PLANE_V], |
1354 decoded_image.video_frame_buffer()->MutableDataY(), | 1355 buffer->MutableDataY(), buffer->StrideY(), |
1355 decoded_image.video_frame_buffer()->StrideY(), | 1356 buffer->MutableDataU(), buffer->StrideU(), |
1356 decoded_image.video_frame_buffer()->MutableDataU(), | 1357 buffer->MutableDataV(), buffer->StrideV(), |
1357 decoded_image.video_frame_buffer()->StrideU(), | |
1358 decoded_image.video_frame_buffer()->MutableDataV(), | |
1359 decoded_image.video_frame_buffer()->StrideV(), | |
1360 img->d_w, img->d_h); | 1358 img->d_w, img->d_h); |
| 1359 |
| 1360 VideoFrame decoded_image(buffer, timestamp, 0, kVideoRotation_0); |
1361 decoded_image.set_ntp_time_ms(ntp_time_ms); | 1361 decoded_image.set_ntp_time_ms(ntp_time_ms); |
1362 int ret = decode_complete_callback_->Decoded(decoded_image); | 1362 int ret = decode_complete_callback_->Decoded(decoded_image); |
1363 if (ret != 0) | 1363 if (ret != 0) |
1364 return ret; | 1364 return ret; |
1365 | 1365 |
1366 // Remember image format for later | 1366 // Remember image format for later |
1367 image_format_ = img->fmt; | 1367 image_format_ = img->fmt; |
1368 return WEBRTC_VIDEO_CODEC_OK; | 1368 return WEBRTC_VIDEO_CODEC_OK; |
1369 } | 1369 } |
1370 | 1370 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 return -1; | 1404 return -1; |
1405 } | 1405 } |
1406 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) != | 1406 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) != |
1407 VPX_CODEC_OK) { | 1407 VPX_CODEC_OK) { |
1408 return -1; | 1408 return -1; |
1409 } | 1409 } |
1410 return 0; | 1410 return 0; |
1411 } | 1411 } |
1412 | 1412 |
1413 } // namespace webrtc | 1413 } // namespace webrtc |
OLD | NEW |