Class VideoMediaDeviceSession

    • Constructor Detail

      • VideoMediaDeviceSession

        public VideoMediaDeviceSession​(AbstractMediaDevice device)
        Initializes a new VideoMediaDeviceSession instance which is to represent the work of a MediaStream with a specific video MediaDevice.
        Parameters:
        device - the video MediaDevice the use of which by a MediaStream is to be represented by the new instance
    • Method Detail

      • addRTCPFeedbackMessageCreateListner

        public void addRTCPFeedbackMessageCreateListner​(RTCPFeedbackMessageCreateListener listener)
        Adds RTCPFeedbackMessageCreateListener.
        Parameters:
        listener - the listener to add
      • addVideoListener

        public void addVideoListener​(VideoListener listener)
        Adds a specific VideoListener to this instance in order to receive notifications when visual/video Components are being added and removed.

        Adding a listener which has already been added does nothing i.e. it is not added more than once and thus does not receive one and the same VideoEvent multiple times.

        Parameters:
        listener - the VideoListener to be notified when visual/video Components are being added or removed in this instance
      • createCaptureDevice

        protected javax.media.protocol.DataSource createCaptureDevice()
        Creates the DataSource that this instance is to read captured media from.
        Overrides:
        createCaptureDevice in class MediaDeviceSession
        Returns:
        the DataSource that this instance is to read captured media from
      • createLocalPlayer

        protected javax.media.Player createLocalPlayer​(javax.media.protocol.DataSource captureDevice)
        Initializes a new Player instance which is to provide the local visual/video Component. The new instance is initialized to render the media of a specific DataSource.
        Parameters:
        captureDevice - the DataSource which is to have its media rendered by the new instance as the local visual/video Component
        Returns:
        a new Player instance which is to provide the local visual/video Component
      • createLocalVisualComponent

        protected Component createLocalVisualComponent()
        Creates the visual Component depicting the video being streamed from the local peer to the remote peer.
        Returns:
        the visual Component depicting the video being streamed from the local peer to the remote peer if it was immediately created or null if it was not immediately created and it is to be delivered to the currently registered VideoListeners in a VideoEvent with type VideoEvent.VIDEO_ADDED and origin VideoEvent.LOCAL
      • disposeLocalPlayer

        protected void disposeLocalPlayer​(javax.media.Player player)
        Releases the resources allocated by a specific local Player in the course of its execution and prepares it to be garbage collected. If the specified Player is rendering video, notifies the VideoListeners of this instance that its visual Component is to no longer be used by firing a VideoEvent.VIDEO_REMOVED VideoEvent.
        Parameters:
        player - the Player to dispose of
        See Also:
        MediaDeviceSession.disposePlayer(Player)
      • disposeLocalVisualComponent

        protected void disposeLocalVisualComponent​(Component component)
        Disposes of the local visual Component of the local peer.
        Parameters:
        component - the local visual Component of the local peer to dispose of
      • disposePlayer

        protected void disposePlayer​(javax.media.Player player)
        Releases the resources allocated by a specific Player in the course of its execution and prepares it to be garbage collected. If the specified Player is rendering video, notifies the VideoListeners of this instance that its visual Component is to no longer be used by firing a VideoEvent.VIDEO_REMOVED VideoEvent.
        Overrides:
        disposePlayer in class MediaDeviceSession
        Parameters:
        player - the Player to dispose of
        See Also:
        MediaDeviceSession.disposePlayer(Player)
      • fireVideoEvent

        protected boolean fireVideoEvent​(int type,
                                         Component visualComponent,
                                         int origin,
                                         boolean wait)
        Notifies the VideoListeners registered with this instance about a specific type of change in the availability of a specific visual Component depicting video.
        Parameters:
        type - the type of change as defined by VideoEvent in the availability of the specified visual Component depicting video
        visualComponent - the visual Component depicting video which has been added or removed in this instance
        origin - VideoEvent.LOCAL if the origin of the video is local (e.g. it is being locally captured); VideoEvent.REMOTE if the origin of the video is remote (e.g. a remote peer is streaming it)
        wait - true if the call is to wait till the specified VideoEvent has been delivered to the VideoListeners; otherwise, false
        Returns:
        true if this event and, more specifically, the visual Component it describes have been consumed and should be considered owned, referenced (which is important because Components belong to a single Container at a time); otherwise, false
      • fireVideoEvent

        protected void fireVideoEvent​(VideoEvent videoEvent,
                                      boolean wait)
        Notifies the VideoListeners registered with this instance about a specific VideoEvent.
        Parameters:
        videoEvent - the VideoEvent to be fired to the VideoListeners registered with this instance
        wait - true if the call is to wait till the specified VideoEvent has been delivered to the VideoListeners; otherwise, false
      • getLocalVisualComponent

        public Component getLocalVisualComponent()
        Gets the visual Component, if any, depicting the video streamed from the local peer to the remote peer.
        Returns:
        the visual Component depicting the local video if local video is actually being streamed from the local peer to the remote peer; otherwise, null
      • getReceivedVideoFormat

        public javax.media.format.VideoFormat getReceivedVideoFormat()
        Returns the FMJ Format of the video we are receiving from the remote peer.
        Returns:
        the FMJ Format of the video we are receiving from the remote peer or null if we are not receiving any video or the FMJ Format of the video we are receiving from the remote peer cannot be determined
      • getSentVideoFormat

        public javax.media.format.VideoFormat getSentVideoFormat()
        Returns the format of the video we are streaming to the remote peer.
        Returns:
        The video format of the sent video. Null, if no video is sent.
      • getVisualComponent

        public Component getVisualComponent​(long ssrc)
        Gets the visual Components rendering the ReceiveStream corresponding to the given ssrc.
        Parameters:
        ssrc - the src-id of the receive stream, which visual Component we're looking for
        Returns:
        the visual Component rendering the ReceiveStream corresponding to the given ssrc
      • getVisualComponents

        public List<Component> getVisualComponents()
        Gets the visual Components where video from the remote peer is being rendered.
        Returns:
        the visual Components where video from the remote peer is being rendered
      • playerSizeChange

        protected void playerSizeChange​(javax.media.Controller sourceController,
                                        int origin,
                                        int width,
                                        int height)
        Notifies this instance that a specific Player of local or remote content/video has generated a SizeChangeEvent.
        Parameters:
        sourceController - the Player which is the source of the event
        origin - VideoEvent.LOCAL or VideoEvent.REMOTE which specifies the origin of the visual Component displaying video which is concerned
        width - the width reported in the event
        height - the height reported in the event
        See Also:
        SizeChangeEvent
      • removeRTCPFeedbackMessageCreateListner

        public void removeRTCPFeedbackMessageCreateListner​(RTCPFeedbackMessageCreateListener listener)
        Removes RTCPFeedbackMessageCreateListener.
        Parameters:
        listener - the listener to remove
      • removeVideoListener

        public void removeVideoListener​(VideoListener listener)
        Removes a specific VideoListener from this instance in order to have to no longer receive notifications when visual/video Components are being added and removed.
        Parameters:
        listener - the VideoListener to no longer be notified when visual/video Components are being added or removed in this instance
      • setConnector

        public void setConnector​(AbstractRTPConnector rtpConnector)
        Sets the RTPConnector that will be used to initialize some codec for RTCP feedback.
        Parameters:
        rtpConnector - the RTP connector
      • setFormat

        public void setFormat​(MediaFormat format)
        Sets the MediaFormat in which this MediaDeviceSession outputs the media captured by its MediaDevice.
        Overrides:
        setFormat in class MediaDeviceSession
        Parameters:
        format - the MediaFormat in which this MediaDeviceSession is to output the media captured by its MediaDevice
      • setKeyFrameControl

        public void setKeyFrameControl​(KeyFrameControl keyFrameControl)
        Sets the KeyFrameControl to be used by this VideoMediaDeviceSession as a means of control over its key frame-related logic.
        Parameters:
        keyFrameControl - the KeyFrameControl to be used by this VideoMediaDeviceSession as a means of control over its key frame-related logic
      • setLocalSSRC

        public void setLocalSSRC​(long localSSRC)
        Set the local SSRC.
        Parameters:
        localSSRC - local SSRC
      • setOutputSize

        public void setOutputSize​(Dimension size)
        Sets the size of the output video.
        Parameters:
        size - the size of the output video
      • setProcessorFormat

        protected javax.media.Format setProcessorFormat​(javax.media.control.TrackControl trackControl,
                                                        MediaFormatImpl<? extends javax.media.Format> mediaFormat,
                                                        javax.media.Format format)
        Sets the MediaFormatImpl of a specific TrackControl of the Processor which produces the media to be streamed by this MediaDeviceSession to the remote peer. Allows extenders to override the set procedure and to detect when the JMF Format of the specified TrackControl changes.
        Overrides:
        setProcessorFormat in class MediaDeviceSession
        Parameters:
        trackControl - the TrackControl to set the JMF Format of
        mediaFormat - the MediaFormatImpl to be set on the specified TrackControl. Though mediaFormat encapsulates a JMF Format, format is to be set on the specified trackControl because it may be more specific. In any case, the two JMF Formats match. The MediaFormatImpl is provided anyway because it carries additional information such as format parameters.
        format - the JMF Format to be set on the specified TrackControl. Though mediaFormat encapsulates a JMF Format, the specified format is to be set on the specified trackControl because it may be more specific than the JMF Format of the mediaFormat
        Returns:
        the JMF Format set on TrackControl after the attempt to set the specified mediaFormat or null if the specified format was found to be incompatible with trackControl
        See Also:
        MediaDeviceSession.setProcessorFormat(TrackControl, MediaFormatImpl, Format)
      • setRemoteSSRC

        public void setRemoteSSRC​(long remoteSSRC)
        Set the remote SSRC.
        Parameters:
        remoteSSRC - remote SSRC
      • setRTCPFeedbackPLI

        public void setRTCPFeedbackPLI​(boolean useRTCPFeedbackPLI)
        Sets the indicator which determines whether RTCP feedback Picture Loss Indication (PLI) is to be used to request keyframes.
        Parameters:
        useRTCPFeedbackPLI - true to use PLI; otherwise, false
      • startedDirectionChanged

        protected void startedDirectionChanged​(MediaDirection oldValue,
                                               MediaDirection newValue)
        Notifies this instance that the value of its startedDirection property has changed from a specific oldValue to a specific newValue.
        Overrides:
        startedDirectionChanged in class MediaDeviceSession
        Parameters:
        oldValue - the MediaDirection which used to be the value of the startedDirection property of this instance
        newValue - the MediaDirection which is the value of the startedDirection property of this instance
      • getLocalPlayer

        protected javax.media.Player getLocalPlayer()
        Return the Player instance which provides the local visual/video Component.
        Returns:
        the Player instance which provides the local visual/video Component.