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