Results 1 to 3 of 3

Thread: MediaCaster starting for already published streams

  1. #1
    Join Date
    Mar 2011
    Posts
    18

    Default MediaCaster starting for already published streams

    Hi,

    I have an application based on ModuleAddAudioTrack.

    The differences are:

    I start the live video source on appStart to keep it running and I use a IMediaStreamNameAliasProvider.

    I start live stream source at appStart using:

    appInstance.setApplicationTimeout(0);
    appInstance.getMediaCasterStreams().acquire(“video-source”);

    as in the ModuleAddAudioTrack I create 2 new stream on “video-source” publish event.

    I create this 2 stream as in example module using:

    publisher = Publisher.createInstance(this.appInstance);
    publisher.setFileExtension("flv");
    publisher.setStreamType("live");
    publisher.publish(“video”, "live");
    audioSource = Stream.createInstance(this.appInstance, “video-audio");
    playlist = new Playlist("audiosource");
    playlist.setRepeat(true);
    playlist.addItem(audioSourcePath, 0, -1);
    playlist.open(this.audioSource);

    It works.

    I can get the “video”, “video-source” , “video-audio” streams using all protocols.

    But behind the scene something strange happens when I call “video” and “video-audio” using RTSP or RTMP

    It works showing the expected content o the player, but Wowza keeps a MediaCaster instance “video” or “video-audio” trying to connect a stream source. I can see it because Mediacaster events I am logging and because of logging I have in resolveStreamAlias. As this method do not have a valid replies for “video” and “video-audio” I return the name (I’ve tried return null too). it causes logs of MediaCaster connectFailure.

    As the the streams named “video” and “video-audio” are already running correctly (I can see it through the player and WowzaStreamEngineManager), it should not start the MediaCaster, right?

    Using HLS protocol something similar happens, but instead start a media caster I get successive calls on resolvePlayAlias.

    Here is a resume of my logs:

    - After start video-source on App
    video-source onMediaCasterCreate
    video-source onConnectStart
    video-source resolveStreamAlias
    video-source onMediaStreamCreate
    video-source onSetSourceStream
    video-source onPublish
    video onMediaStreamCreate
    video-source onConnectSuccess
    video onPublish
    video-audio onMediaStreamCreate
    video-audio onPublish

    - After connect video-source using RTSP or RTMP client - THIS STREAM RUNS AS EXPECTED
    video-source onMediaStreamCreate
    video-source resolvePlayAlias
    video-source MediaStreamMediaCasterPlay: startPlay
    video-source onRegisterPlayer
    video-source onPlay

    - After close RTSP or RTMP connection
    video-source onUnRegisterPlayer
    video-source onStop
    video-source onDestroy

    - After connect videousing RTSP or RTMP - NOW MEDIACASTER START WITH NO REASON this strea in already published
    video onMediaStreamCreate
    video resolvePlayAlias - HERE I RETURN “video”, right?
    video MediaStreamMediaCasterPlay: startPlay
    video onMediaCasterCreate - I THINK IT SHOULD NOT START
    video onRegisterPlayer
    video MediaCaster.onConnectStart
    video resolveStreamAlias - HERE I RETURN “video”. I THINK THIS METHOS SHOULD NOT BE CALLED
    video MediaCaster.onConnectFailure
    ..
    video MediaCaster.onConnectStart
    video resolveStreamAlias - HERE I RETURN “video”. I THINK THIS METHOS SHOULD NOT BE CALLED
    video MediaCaster.onConnectFailure


    - After close RTSP or RTMP connection
    video onUnRegisterPlayer
    video onStop
    video onDestroy

    What I am missing the avoid to start the MediaCaster unnecessarily? The stream are already running.

    I am missing something?

    My application streamtype is "rtp-live-lowlatency".

    Does it happen because streamtype for "video" should be "live"? If it is the problem How do a set streamType on steam name basis?

    Thanks.

    Rafael Sobral
    Last edited by rsobral; 05-07-2014 at 01:32 PM.

  2. #2

    Default

    Hi,

    In your code I can see

    publisher = Publisher.createInstance(this.appInstance);
    publisher.setFileExtension("flv");
    publisher.setStreamType("live");
    publisher.publish(“video”, "live");

    but then no data being send to it. This will be why it is constantly trying to reconnect. If there is no data, then Wowza will drop the connection and reconnnect, it may be doing this as the stream is empty.

    Andrew.

  3. #3
    Join Date
    Mar 2011
    Posts
    18

    Default

    Hi Andrew,

    The stream is not empty because is plays correctly on the player.

    I use the methods bellow in a loop to add the content to the stream, just like in ModuleAddAudioTrack:

    this.publisher.addAudioData(APacket.getData(), APacket.getData().length, APacket.getAbsTimecode() + offsetTimeCode);
    ...
    this.publisher.addVideoData(VPacket.getData(), VPacket.getData().length, VPacket.getAbsTimecode());

    I added the following statement in onConnect method of Module and it is not firing MediaCaster anymore.

    client.setStreamType("live");

    The following post was very helpfull to get closer to understand what is going on.

    http://www.wowza.com/forums/showthre...IVE-vs-RTPLIVE

    I would like to know if it is the correct approach.

    I would like to known too if it is possible to set it on stream basis and not on client connection basis as I did. To avoid it affect all stream in client connection.

    Thanks.

    Aloha,

    Rafael Sobral

Similar Threads

  1. start and stop MediaCaster streams
    By fubalytics in forum General Forum
    Replies: 10
    Last Post: 04-19-2014, 02:08 PM
  2. Many published streams, cpu load
    By qstream in forum General Forum
    Replies: 3
    Last Post: 04-13-2014, 08:02 PM
  3. Advanced MediaCaster streams control
    By Yury Udovichenko in forum Showcase
    Replies: 2
    Last Post: 04-15-2013, 05:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •