OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
957 if (img == NULL) { | 957 if (img == NULL) { |
958 // Decoder OK and NULL image => No show frame. | 958 // Decoder OK and NULL image => No show frame. |
959 return WEBRTC_VIDEO_CODEC_NO_OUTPUT; | 959 return WEBRTC_VIDEO_CODEC_NO_OUTPUT; |
960 } | 960 } |
961 | 961 |
962 // This buffer contains all of |img|'s image data, a reference counted | 962 // This buffer contains all of |img|'s image data, a reference counted |
963 // Vp9FrameBuffer. (libvpx is done with the buffers after a few | 963 // Vp9FrameBuffer. (libvpx is done with the buffers after a few |
964 // vpx_codec_decode calls or vpx_codec_destroy). | 964 // vpx_codec_decode calls or vpx_codec_destroy). |
965 Vp9FrameBufferPool::Vp9FrameBuffer* img_buffer = | 965 Vp9FrameBufferPool::Vp9FrameBuffer* img_buffer = |
966 static_cast<Vp9FrameBufferPool::Vp9FrameBuffer*>(img->fb_priv); | 966 static_cast<Vp9FrameBufferPool::Vp9FrameBuffer*>(img->fb_priv); |
967 | |
968 VideoFrameBuffer::Type type = img->fmt == VPX_IMG_FMT_I444 | |
969 ? VideoFrameBuffer::Type::kI444 | |
970 : VideoFrameBuffer::Type::kI420; | |
971 | |
967 // The buffer can be used directly by the VideoFrame (without copy) by | 972 // The buffer can be used directly by the VideoFrame (without copy) by |
968 // using a WrappedI420Buffer. | 973 // using a WrappedI4??Buffer. |
magjed_webrtc
2017/06/20 09:01:15
Use WrapYuvBuffer instead of WrappedI4??Buffer now
Yuwei
2017/06/22 01:17:24
Done.
| |
969 rtc::scoped_refptr<WrappedI420Buffer> img_wrapped_buffer( | 974 rtc::scoped_refptr<VideoFrameBuffer> img_wrapped_buffer = WrapYuvBuffer( |
970 new rtc::RefCountedObject<webrtc::WrappedI420Buffer>( | 975 type, img->d_w, img->d_h, img->planes[VPX_PLANE_Y], |
971 img->d_w, img->d_h, img->planes[VPX_PLANE_Y], | 976 img->stride[VPX_PLANE_Y], img->planes[VPX_PLANE_U], |
972 img->stride[VPX_PLANE_Y], img->planes[VPX_PLANE_U], | 977 img->stride[VPX_PLANE_U], img->planes[VPX_PLANE_V], |
973 img->stride[VPX_PLANE_U], img->planes[VPX_PLANE_V], | 978 img->stride[VPX_PLANE_V], |
974 img->stride[VPX_PLANE_V], | 979 // WrappedI4??Buffer's mechanism for allowing the release of its frame |
magjed_webrtc
2017/06/20 09:01:15
ditto, use WrapYuvBuffer instead of WrappedI4??Buf
Yuwei
2017/06/22 01:17:24
Done.
| |
975 // WrappedI420Buffer's mechanism for allowing the release of its frame | 980 // buffer is through a callback function. This is where we should |
976 // buffer is through a callback function. This is where we should | 981 // release |img_buffer|. |
977 // release |img_buffer|. | 982 rtc::KeepRefUntilDone(img_buffer)); |
978 rtc::KeepRefUntilDone(img_buffer))); | |
979 | 983 |
980 VideoFrame decoded_image(img_wrapped_buffer, timestamp, | 984 VideoFrame decoded_image(img_wrapped_buffer, timestamp, |
981 0 /* render_time_ms */, webrtc::kVideoRotation_0); | 985 0 /* render_time_ms */, webrtc::kVideoRotation_0); |
982 decoded_image.set_ntp_time_ms(ntp_time_ms); | 986 decoded_image.set_ntp_time_ms(ntp_time_ms); |
983 | 987 |
984 decode_complete_callback_->Decoded(decoded_image, rtc::Optional<int32_t>(), | 988 decode_complete_callback_->Decoded(decoded_image, rtc::Optional<int32_t>(), |
985 rtc::Optional<uint8_t>(qp)); | 989 rtc::Optional<uint8_t>(qp)); |
986 return WEBRTC_VIDEO_CODEC_OK; | 990 return WEBRTC_VIDEO_CODEC_OK; |
987 } | 991 } |
988 | 992 |
(...skipping 19 matching lines...) Expand all Loading... | |
1008 frame_buffer_pool_.ClearPool(); | 1012 frame_buffer_pool_.ClearPool(); |
1009 inited_ = false; | 1013 inited_ = false; |
1010 return WEBRTC_VIDEO_CODEC_OK; | 1014 return WEBRTC_VIDEO_CODEC_OK; |
1011 } | 1015 } |
1012 | 1016 |
1013 const char* VP9DecoderImpl::ImplementationName() const { | 1017 const char* VP9DecoderImpl::ImplementationName() const { |
1014 return "libvpx"; | 1018 return "libvpx"; |
1015 } | 1019 } |
1016 | 1020 |
1017 } // namespace webrtc | 1021 } // namespace webrtc |
OLD | NEW |