Delivers VideoEvent.VIDEO_REMOVED for the local visual component of desktop streaming/sharing. Reported by Yana Stamcheva.

cusax-fix
Lyubomir Marinov 15 years ago
parent 91df3e2da0
commit 657fe8e68f

@ -731,12 +731,11 @@ private void handleVideoEvent(final VideoEvent event)
{
if (event != null && logger.isTraceEnabled())
logger.trace("UI video event received originated in: "
+ event.getOrigin() + " and of type: " + event.getType());
+ event.getOrigin() + " and is of type: " + event.getType());
synchronized (videoContainers)
{
if ((event != null)
&& !event.isConsumed())
if ((event != null) && !event.isConsumed())
{
Component video = event.getVisualComponent();

@ -416,14 +416,17 @@ public void videoUpdate(VideoEvent e)
/**
* Disposes of the visual <tt>Component</tt> of the local peer.
*
* @param component the visual <tt>Component</tt> of the local peer to
* dispose of
*/
public void disposeLocalVisualComponent()
public void disposeLocalVisualComponent(Component component)
{
MediaDeviceSession deviceSession = getDeviceSession();
if(deviceSession instanceof VideoMediaDeviceSession)
((VideoMediaDeviceSession) deviceSession)
.disposeLocalVisualComponent();
.disposeLocalVisualComponent(component);
}
/**

@ -594,16 +594,39 @@ public void paint(Graphics g)
canvas.setMaximumSize(iconSize);
canvas.setPreferredSize(iconSize);
fireVideoEvent(VideoEvent.LOCAL, canvas, VideoEvent.LOCAL);
/*
* Set a clue so that we can recognize it if it gets received as an
* argument to #disposeLocalVisualComponent().
*/
canvas.setName(DESKTOP_STREAMING_ICON);
fireVideoEvent(VideoEvent.VIDEO_ADDED, canvas, VideoEvent.LOCAL);
}
return canvas;
}
/**
* Disposes the local visual <tt>Component</tt> of the local peer.
*
* @param component the local visual <tt>Component</tt> of the local peer to
* dispose of
*/
public void disposeLocalVisualComponent()
public void disposeLocalVisualComponent(Component component)
{
/*
* Desktop streaming does not use a Player but a Canvas with its name
* equals to the value of DESKTOP_STREAMING_ICON.
*/
if ((component != null)
&& DESKTOP_STREAMING_ICON.equals(component.getName()))
{
fireVideoEvent(
VideoEvent.VIDEO_REMOVED,
component,
VideoEvent.LOCAL);
return;
}
Player localPlayer = this.localPlayer;
if (localPlayer != null)

@ -28,9 +28,12 @@ public interface VideoMediaStream
public Component createLocalVisualComponent();
/**
* Dispose local visual <tt>Component</tt> of the local peer.
* Disposes of a specific local visual <tt>Component</tt> of the local peer.
*
* @param component the local visual <tt>Component</tt> of the local peer to
* dispose of
*/
public void disposeLocalVisualComponent();
public void disposeLocalVisualComponent(Component component);
/**
* Returns a reference to the visual <tt>Component</tt> where video from the

@ -118,7 +118,7 @@ public Component createLocalVisualComponent(
@SuppressWarnings("unchecked") // work with MediaAware* in media package
public void disposeLocalVisualComponent(CallPeer peer, Component component)
{
((W)peer).getMediaHandler().disposeLocalVisualComponent();
((W)peer).getMediaHandler().disposeLocalVisualComponent(component);
}
/**

@ -979,19 +979,22 @@ public void fireVideoEvent(VideoEvent event)
*/
public Component createLocalVisualComponent()
{
return (videoStream == null || !isLocalVideoTransmissionEnabled())
? null : videoStream.createLocalVisualComponent();
return
((videoStream == null) || !isLocalVideoTransmissionEnabled())
? null
: videoStream.createLocalVisualComponent();
}
/**
* Dispose local visual <tt>Component</tt> of the local peer.
* Disposes of a specific local visual <tt>Component</tt> of the local peer.
*
* @param component the local visual <tt>Component</tt> of the local peer to
* dispose of
*/
public void disposeLocalVisualComponent()
public void disposeLocalVisualComponent(Component component)
{
if(videoStream != null)
{
videoStream.disposeLocalVisualComponent();
}
if (videoStream != null)
videoStream.disposeLocalVisualComponent(component);
}
/**

Loading…
Cancel
Save