content/browser/android/surface_texture_peer_browser_impl.cc
// Pass a java surface object to the MediaPlayerBridge object
// identified by render process handle, render view ID and player ID.
Pass a java surface object to the MediaPlayerBridge object
identified by render process handle, render view ID and player ID.
Pass a java surface object to the MediaPlayerBridge object identified by render process handle render view ID and player ID .
static void SetSurfacePeer(
    scoped_refptr<SurfaceTextureBridge> surface_texture_bridge,
    base::ProcessHandle render_process_handle,
    int render_view_id,
    int player_id) {
  int renderer_id = 0;
  RenderProcessHost::iterator it = RenderProcessHost::AllHostsIterator();
  while (!it.IsAtEnd()) {
    if (it.GetCurrentValue()->GetHandle() == render_process_handle) {
      renderer_id = it.GetCurrentValue()->GetID();
      break;
    }
    it.Advance();
  }
  JNIEnv* env = base::android::AttachCurrentThread();
  DCHECK(env);
  if (renderer_id) {
    RenderViewHostImpl* host = RenderViewHostImpl::FromID(
        renderer_id, render_view_id);
    if (host) {
      media::MediaPlayerBridge* player =
          host->media_player_manager()->GetPlayer(player_id);
      if (player &&
          player != host->media_player_manager()->GetFullscreenPlayer()) {
        base::android::ScopedJavaLocalRef<jclass> cls(
            base::android::GetClass(env, "android/view/Surface"));
        jmethodID constructor = MethodID::Get<MethodID::TYPE_INSTANCE>(
            env, cls.obj(), "<init>", "(Landroid/graphics/SurfaceTexture;)V");
        ScopedJavaLocalRef<jobject> j_surface(
            env, env->NewObject(
                cls.obj(), constructor,
                surface_texture_bridge->j_surface_texture().obj()));
        player->SetVideoSurface(j_surface.obj());
        ReleaseSurface(j_surface.obj());
      }
    }
  }
}
static void SetSurfacePeer ( scoped_refptr < SurfaceTextureBridge > surface_texture_bridge , base :: ProcessHandle render_process_handle , int render_view_id , int player_id ) { int renderer_id = 0 ; RenderProcessHost :: iterator it = RenderProcessHost :: AllHostsIterator ( ) ; while ( ! it . IsAtEnd ( ) ) { if ( it . GetCurrentValue ( ) -> GetHandle ( ) == render_process_handle ) { renderer_id = it . GetCurrentValue ( ) -> GetID ( ) ; break ; } it . Advance ( ) ; } JNIEnv * env = base :: android :: AttachCurrentThread ( ) ; DCHECK ( env ) ; if ( renderer_id ) { RenderViewHostImpl * host = RenderViewHostImpl :: FromID ( renderer_id , render_view_id ) ; if ( host ) { media :: MediaPlayerBridge * player = host -> media_player_manager ( ) -> GetPlayer ( player_id ) ; if ( player && player != host -> media_player_manager ( ) -> GetFullscreenPlayer ( ) ) { base :: android :: ScopedJavaLocalRef < jclass > cls ( base :: android :: GetClass ( env , " " ) ) ; jmethodID constructor = MethodID :: Get < MethodID :: TYPE_INSTANCE > ( env , cls . obj ( ) , " " , " " ) ; ScopedJavaLocalRef < jobject > j_surface ( env , env -> NewObject ( cls . obj ( ) , constructor , surface_texture_bridge -> j_surface_texture ( ) . obj ( ) ) ) ; player -> SetVideoSurface ( j_surface . obj ( ) ) ; ReleaseSurface ( j_surface . obj ( ) ) ; } } } }
Pass a java surface object to the MediaPlayerBridge object
identified by render process handle, render view ID and player ID.
Pass a java surface object to the MediaPlayerBridge object identified by render process handle render view ID and player ID .