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 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 // recycled during use (libvpx is done with the buffers after a few | 733 // recycled during use (libvpx is done with the buffers after a few |
734 // vpx_codec_decode calls or vpx_codec_destroy). | 734 // vpx_codec_decode calls or vpx_codec_destroy). |
735 Vp9FrameBufferPool::Vp9FrameBuffer* img_buffer = | 735 Vp9FrameBufferPool::Vp9FrameBuffer* img_buffer = |
736 static_cast<Vp9FrameBufferPool::Vp9FrameBuffer*>(img->fb_priv); | 736 static_cast<Vp9FrameBufferPool::Vp9FrameBuffer*>(img->fb_priv); |
737 img_buffer->AddRef(); | 737 img_buffer->AddRef(); |
738 // The buffer can be used directly by the VideoFrame (without copy) by | 738 // The buffer can be used directly by the VideoFrame (without copy) by |
739 // using a WrappedI420Buffer. | 739 // using a WrappedI420Buffer. |
740 rtc::scoped_refptr<WrappedI420Buffer> img_wrapped_buffer( | 740 rtc::scoped_refptr<WrappedI420Buffer> img_wrapped_buffer( |
741 new rtc::RefCountedObject<webrtc::WrappedI420Buffer>( | 741 new rtc::RefCountedObject<webrtc::WrappedI420Buffer>( |
742 img->d_w, img->d_h, | 742 img->d_w, img->d_h, |
743 img->d_w, img->d_h, | |
744 img->planes[VPX_PLANE_Y], img->stride[VPX_PLANE_Y], | 743 img->planes[VPX_PLANE_Y], img->stride[VPX_PLANE_Y], |
745 img->planes[VPX_PLANE_U], img->stride[VPX_PLANE_U], | 744 img->planes[VPX_PLANE_U], img->stride[VPX_PLANE_U], |
746 img->planes[VPX_PLANE_V], img->stride[VPX_PLANE_V], | 745 img->planes[VPX_PLANE_V], img->stride[VPX_PLANE_V], |
747 // WrappedI420Buffer's mechanism for allowing the release of its frame | 746 // WrappedI420Buffer's mechanism for allowing the release of its frame |
748 // buffer is through a callback function. This is where we should | 747 // buffer is through a callback function. This is where we should |
749 // release |img_buffer|. | 748 // release |img_buffer|. |
750 rtc::Bind(&WrappedI420BufferNoLongerUsedCb, img_buffer))); | 749 rtc::Bind(&WrappedI420BufferNoLongerUsedCb, img_buffer))); |
751 | 750 |
752 VideoFrame decoded_image; | 751 VideoFrame decoded_image; |
753 decoded_image.set_video_frame_buffer(img_wrapped_buffer); | 752 decoded_image.set_video_frame_buffer(img_wrapped_buffer); |
(...skipping 21 matching lines...) Expand all Loading... |
775 decoder_ = NULL; | 774 decoder_ = NULL; |
776 } | 775 } |
777 // Releases buffers from the pool. Any buffers not in use are deleted. Buffers | 776 // Releases buffers from the pool. Any buffers not in use are deleted. Buffers |
778 // still referenced externally are deleted once fully released, not returning | 777 // still referenced externally are deleted once fully released, not returning |
779 // to the pool. | 778 // to the pool. |
780 frame_buffer_pool_.ClearPool(); | 779 frame_buffer_pool_.ClearPool(); |
781 inited_ = false; | 780 inited_ = false; |
782 return WEBRTC_VIDEO_CODEC_OK; | 781 return WEBRTC_VIDEO_CODEC_OK; |
783 } | 782 } |
784 } // namespace webrtc | 783 } // namespace webrtc |
OLD | NEW |