Remove usage of webrtc::NativeHandle since is just adds an extra level of indirection.
BUG=1128
R=magjed@webrtc.org, pbos@webrtc.org
TBR=mflodman@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/43999004
Cr-Commit-Position: refs/heads/master@{#8932}
diff --git a/talk/app/webrtc/java/jni/androidmediadecoder_jni.cc b/talk/app/webrtc/java/jni/androidmediadecoder_jni.cc
index da6921f..2c2c12d 100644
--- a/talk/app/webrtc/java/jni/androidmediadecoder_jni.cc
+++ b/talk/app/webrtc/java/jni/androidmediadecoder_jni.cc
@@ -654,8 +654,9 @@
int32_t callback_status = WEBRTC_VIDEO_CODEC_OK;
if (use_surface_) {
native_handle_.SetTextureObject(surface_texture_, texture_id);
- I420VideoFrame texture_image(
- &native_handle_, width, height, output_timestamp_, 0);
+ I420VideoFrame texture_image(&native_handle_, width, height,
+ output_timestamp_, 0, webrtc::kVideoRotation_0,
+ rtc::Callback0<void>());
texture_image.set_ntp_time_ms(output_ntp_time_ms_);
callback_status = callback_->Decoded(texture_image);
} else {
diff --git a/talk/app/webrtc/java/jni/native_handle_impl.h b/talk/app/webrtc/java/jni/native_handle_impl.h
index 7de29d1..a10a4f3 100644
--- a/talk/app/webrtc/java/jni/native_handle_impl.h
+++ b/talk/app/webrtc/java/jni/native_handle_impl.h
@@ -33,19 +33,12 @@
namespace webrtc_jni {
-// Wrapper for texture object in TextureBuffer.
-class NativeHandleImpl : public webrtc::NativeHandle {
+// Wrapper for texture object.
+class NativeHandleImpl {
public:
- NativeHandleImpl() :
- ref_count_(0), texture_object_(NULL), texture_id_(-1) {}
- virtual ~NativeHandleImpl() {}
- virtual int32_t AddRef() {
- return ++ref_count_;
- }
- virtual int32_t Release() {
- return --ref_count_;
- }
- virtual void* GetHandle() {
+ NativeHandleImpl() : texture_object_(NULL), texture_id_(-1) {}
+
+ void* GetHandle() {
return texture_object_;
}
int GetTextureId() {
@@ -55,12 +48,8 @@
texture_object_ = reinterpret_cast<jobject>(texture_object);
texture_id_ = texture_id;
}
- int32_t ref_count() {
- return ref_count_;
- }
private:
- int32_t ref_count_;
jobject texture_object_;
int32_t texture_id_;
};
diff --git a/talk/media/webrtc/webrtcvideoframe.cc b/talk/media/webrtc/webrtcvideoframe.cc
index e308a73..055e24d 100644
--- a/talk/media/webrtc/webrtcvideoframe.cc
+++ b/talk/media/webrtc/webrtcvideoframe.cc
@@ -71,23 +71,6 @@
rotation_(webrtc::kVideoRotation_0) {
}
-WebRtcVideoFrame::WebRtcVideoFrame(webrtc::NativeHandle* handle,
- int width,
- int height,
- int64_t elapsed_time_ns,
- int64_t time_stamp_ns,
- webrtc::VideoRotation rotation)
- : video_frame_buffer_(
- new rtc::RefCountedObject<webrtc::TextureBuffer>(handle,
- width,
- height)),
- pixel_width_(1),
- pixel_height_(1),
- elapsed_time_ns_(elapsed_time_ns),
- time_stamp_ns_(time_stamp_ns),
- rotation_(rotation) {
-}
-
WebRtcVideoFrame::~WebRtcVideoFrame() {}
bool WebRtcVideoFrame::Init(uint32 format,
diff --git a/talk/media/webrtc/webrtcvideoframe.h b/talk/media/webrtc/webrtcvideoframe.h
index a1872c5..06ac52b 100644
--- a/talk/media/webrtc/webrtcvideoframe.h
+++ b/talk/media/webrtc/webrtcvideoframe.h
@@ -52,12 +52,6 @@
int64_t elapsed_time_ns,
int64_t time_stamp_ns);
- WebRtcVideoFrame(webrtc::NativeHandle* handle,
- int width,
- int height,
- int64_t elapsed_time_ns,
- int64_t time_stamp_ns,
- webrtc::VideoRotation rotation);
~WebRtcVideoFrame();
// Creates a frame from a raw sample with FourCC "format" and size "w" x "h".
diff --git a/talk/media/webrtc/webrtcvideoframe_unittest.cc b/talk/media/webrtc/webrtcvideoframe_unittest.cc
index 8cbe479..e3c4311 100644
--- a/talk/media/webrtc/webrtcvideoframe_unittest.cc
+++ b/talk/media/webrtc/webrtcvideoframe_unittest.cc
@@ -30,19 +30,6 @@
#include "talk/media/base/videoframe_unittest.h"
#include "talk/media/webrtc/webrtcvideoframe.h"
-class NativeHandleImpl : public webrtc::NativeHandle {
- public:
- NativeHandleImpl() : ref_count_(0) {}
- virtual ~NativeHandleImpl() {}
- virtual int32_t AddRef() { return ++ref_count_; }
- virtual int32_t Release() { return --ref_count_; }
- virtual void* GetHandle() { return NULL; }
-
- int32_t ref_count() { return ref_count_; }
- private:
- int32_t ref_count_;
-};
-
namespace {
class WebRtcVideoTestFrame : public cricket::WebRtcVideoFrame {
@@ -339,10 +326,12 @@
}
TEST_F(WebRtcVideoFrameTest, TextureInitialValues) {
- NativeHandleImpl handle;
- cricket::WebRtcVideoFrame frame(&handle, 640, 480, 100, 200,
- webrtc::kVideoRotation_0);
- EXPECT_EQ(&handle, frame.GetNativeHandle());
+ void* dummy_handle = reinterpret_cast<void*>(0x1);
+ webrtc::TextureBuffer* buffer =
+ new rtc::RefCountedObject<webrtc::TextureBuffer>(dummy_handle, 640, 480,
+ rtc::Callback0<void>());
+ cricket::WebRtcVideoFrame frame(buffer, 100, 200, webrtc::kVideoRotation_0);
+ EXPECT_EQ(dummy_handle, frame.GetNativeHandle());
EXPECT_EQ(640u, frame.GetWidth());
EXPECT_EQ(480u, frame.GetHeight());
EXPECT_EQ(100, frame.GetElapsedTime());
@@ -354,9 +343,11 @@
}
TEST_F(WebRtcVideoFrameTest, CopyTextureFrame) {
- NativeHandleImpl handle;
- cricket::WebRtcVideoFrame frame1(&handle, 640, 480, 100, 200,
- webrtc::kVideoRotation_0);
+ void* dummy_handle = reinterpret_cast<void*>(0x1);
+ webrtc::TextureBuffer* buffer =
+ new rtc::RefCountedObject<webrtc::TextureBuffer>(dummy_handle, 640, 480,
+ rtc::Callback0<void>());
+ cricket::WebRtcVideoFrame frame1(buffer, 100, 200, webrtc::kVideoRotation_0);
cricket::VideoFrame* frame2 = frame1.Copy();
EXPECT_EQ(frame1.GetNativeHandle(), frame2->GetNativeHandle());
EXPECT_EQ(frame1.GetWidth(), frame2->GetWidth());