Convert native handles to buffers before encoding.

Required to permit conversion of NV12 handles on iOS to I420 for VP8
software encoding, which blocks texture-based capture. This change
enforces that all texture-based input provides a method for converting
native handles to I420 if they are ever used with software encoders that
do not understand the native handles.

BUG=4081
R=emircan@chromium.org, glaznev@webrtc.org, hbos@webrtc.org, magjed@webrtc.org, mflodman@webrtc.org, stefan@webrtc.org, tkchin@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/50909005

Cr-Commit-Position: refs/heads/master@{#9347}
diff --git a/talk/app/webrtc/java/jni/androidmediadecoder_jni.cc b/talk/app/webrtc/java/jni/androidmediadecoder_jni.cc
index b92b2de..9952e26 100644
--- a/talk/app/webrtc/java/jni/androidmediadecoder_jni.cc
+++ b/talk/app/webrtc/java/jni/androidmediadecoder_jni.cc
@@ -654,9 +654,9 @@
   int32_t callback_status = WEBRTC_VIDEO_CODEC_OK;
   if (use_surface_) {
     native_handle_.SetTextureObject(surface_texture_, texture_id);
-    VideoFrame texture_image(&native_handle_, width, height, output_timestamp_,
-                             0, webrtc::kVideoRotation_0,
-                             rtc::Callback0<void>());
+    VideoFrame texture_image(new rtc::RefCountedObject<JniNativeHandleBuffer>(
+                                 &native_handle_, width, height),
+                             output_timestamp_, 0, webrtc::kVideoRotation_0);
     texture_image.set_ntp_time_ms(output_ntp_time_ms_);
     callback_status = callback_->Decoded(texture_image);
   } else {