1.media_player_bridge.cc
void MediaPlayerBridge::OnExternalVideoSurfacePositionChanged(int id , const gfx::RectF& rect)
{
Java_MediaPlayerBridge_OnExternalVideoSurfacePositionChanged(
env, j_media_player_bridge_.obj(),id,rect.x(),rect.y(),rect.x()+rect.width(),rect.y()+rect.height());
}
2.browser_media_player_manager.cc
void BrowserMediaPlayerManager::ExternalVideoSurfacePositionChanged(int id, const gfx::RectF& rect)
{
MediaPlayerAndroid* lastPlayer = GetPlayer(last_player_id_);
if(lastPlayer){
MediaPlayerBridge* lastBridge = static_cast<MediaPlayerBridge*>(lastPlayer);
//invoke java to remove previous videoview
if(lastBridge)
lastBridge->OnExternalVideoSurfacePositionChanged(id,rect);
}
}
ExternalVideoSurfacePositionChanged()方法被调用
void BrowserMediaPlayerManager::OnNotifyExternalSurface(
int player_id, bool is_request, const gfx::RectF& rect) {
//zhangls add
if (!is_request)
{
ExternalVideoSurfacePositionChanged(player_id,rect);
}
//end
}
通过IPC调用 OnExternalSurface
#if defined(VIDEO_HOLE)
IPC_MESSAGE_FORWARD(MediaPlayerHostMsg_NotifyExternalSurface,
GetMediaPlayerManager(render_frame_host), BrowserMediaPlayerManager::OnNotifyExternalSurface)
#endif // defined(VIDEO_HOLE)
MSG 在 media_player_messages_android.h 中定义
renderer_media_player_manager.cc 发送消息
#if defined(VIDEO_HOLE)
//1 send
void RendererMediaPlayerManager::RequestExternalSurface(
int player_id,
const gfx::RectF& geometry) {
Send(new MediaPlayerHostMsg_NotifyExternalSurface(
routing_id(), player_id, true, geometry));
}
//2 send
void RendererMediaPlayerManager::DidCommitCompositorFrame() {
std::map<int, gfx::RectF> geometry_change;
RetrieveGeometryChanges(&geometry_change);
for (std::map<int, gfx::RectF>::iterator it = geometry_change.begin();
it != geometry_change.end();
++it) {
Send(new MediaPlayerHostMsg_NotifyExternalSurface(
routing_id(), it->first, false, it->second));
}
}
调用这两个方法的地方比较多,不在跟踪
网友评论