Reland of Android: Put common native VideoFrameBuffer implementation in androidvideocapturer_jni (patchset #1 id:1 of https://codereview.webrtc.org/1389283003/ )

Reason for revert:
Nothing wrong with the original CL, the bug was in rtc::Bind(), which is fixed now (https://codereview.webrtc.org/1403683004/).

Original issue's description:
> Revert of Android: Put common native VideoFrameBuffer implementation in androidvideocapturer_jni (patchset #1 id:1 of https://codereview.webrtc.org/1391403004/ )
>
> Reason for revert:
> Crashes on AppRTCDemo disconnect
>
> Original issue's description:
> > Android: Put common native VideoFrameBuffer implementation in native_handle_impl.cc
> >
> > BUG=webrtc:4993
> > R=perkj@webrtc.org
> >
> > Committed: https://crrev.com/60472216da0644b49ed5f9fa51c51d4874afafa7
> > Cr-Commit-Position: refs/heads/master@{#10248}
>
> TBR=perkj@webrtc.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:4993
>
> Committed: https://crrev.com/962c26bfd6c3eb3cf7402daaab89404ae38dd534
> Cr-Commit-Position: refs/heads/master@{#10249}

TBR=perkj@webrtc.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:4993

Review URL: https://codereview.webrtc.org/1397373002

Cr-Commit-Position: refs/heads/master@{#10254}
This commit is contained in:
magjed
2015-10-12 06:53:20 -07:00
committed by Commit bot
parent 1b40a9a8af
commit 52a30e31f1
5 changed files with 41 additions and 57 deletions

View File

@ -31,6 +31,8 @@
#include <jni.h>
#include "webrtc/common_video/interface/video_frame_buffer.h"
namespace webrtc_jni {
// Wrapper for texture object.
@ -43,6 +45,20 @@ struct NativeHandleImpl {
float sampling_matrix[16];
};
class AndroidTextureBuffer : public webrtc::NativeHandleBuffer {
public:
AndroidTextureBuffer(int width,
int height,
const NativeHandleImpl& native_handle,
const rtc::Callback0<void>& no_longer_used);
~AndroidTextureBuffer();
rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override;
private:
NativeHandleImpl native_handle_;
rtc::Callback0<void> no_longer_used_cb_;
};
} // namespace webrtc_jni
#endif // TALK_APP_WEBRTC_JAVA_JNI_NATIVE_HANDLE_IMPL_H_