Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Origin -- Edge -- STB over RTMP: keyframe issue?

  1. #1

    Question Origin -- Edge -- STB over RTMP: keyframe issue?

    Hi!

    Setup includes Origin server, Edge server, mag250 STB, and live streams over RTMP.

    If stream was already started up when STB connects to play it, everything works fine. So for example streams started with StartupStreams.xml, or streams that were already started and are active on Edge server, works good.

    But if this is the first time box requests this stream from Edge (triggering stream startup) - there is no video, only sound on the box. If you move away from this channel and get back to it, while Edge server did not stop the streaming yet, picture will appear.

    (Same setup works fine on web players and in VLC, so this issue is specific to mag250 STB and maybe some other boxes)

    Is there any setting that will allow Edge server to wait for a keyframe before actually starting streaming to STB, or some buffer, or delay between stream launch on Edge and streaming it out, or anything of this sort, that will allow recently started stream to be fully prepared, before streaming it to the client?

    Many thanks.

    UPD: Wowza Streaming Engine 4.0.1 and 4.0.3 on Linux and Windows, issue is 100% reproducible

  2. #2

    Default

    Hi,

    You could try

    http://www.wowza.com/forums/content....de-sort-buffer

    Set it to say 2000 then this may help the problem you are seeing.

    If that does not work then you would need to lock the edge to the origin , example of which can be found here

    http://www.wowza.com/forums/content....-repeater-edge

    Andrew.

  3. #3

    Default

    Hi Andrew, thank you for the reply.

    First approach did not help, while second defeats the whole purpose of Origin-Edge configuration for us. We have multiple Origin servers, and dozens of Edges, and few hundred live channels, we just cant lock Edges to Origins - we need streams to be pulled from Origin to Edge only by demand.

    I can add something to the initial input, or rework it a bit.

    Case 1. No picture on STB

    Origin: stream is up and running, launched from StartupStreams.xls
    Edge: stream configured in .stream file, currently not running
    Box connects to Edge
    Stream starts on Edge
    Box has sound but no picture

    Case 2. STB has picture

    Origin: stream is up and running, launched from StartupStreams.xls
    Edge: stream is up and running, launched by previous box connection (and still is up, timeout did not happen yet, or there are more clients "holding" this stream)
    Box connects to Edge
    Box has sound and picture

    Case 3. STB has picture v2

    Origin: stream is up and running, launched from StartupStreams.xls
    Edge: stream is up and running, launched by previous box connection (and still is up, timeout did not happen yet)
    Box connects to Edge
    Box has sound and picture
    Now we restart Application on Edge
    Box looses feed
    Application started, box connects to it
    Stream starts on Edge
    Box has sound and picture

    By comparing cases 2 and 3 we see that if box managed to get proper video once, and it did not have a chance to destroy its player instance or reset it (app restart is fast enough, and we did not change channel on the box since last succesful playback) - it starts playback properly from recently launched on the Edge stream.

    In case 3, it looks pretty much like box has some crucial piece of data stuck/buffered after first playback, that helps to resume playback properly. It does not work without it. It looks a lot like a keyframe.
    Last edited by AlexeyTs; 04-23-2014 at 02:20 AM.

  4. #4

    Default

    The following code on Edge eliminates the issue (obviously not good for production, just a research), so there is definitely something wrong with a stream in the first few seconds after it is being pulled from Origin

    UPD: *Sometimes* eliminates the issue

    UPD2: Changing sleep(5000) to sleep(10000) makes it enough to work 10 times from 10

    public void play(IClient client, RequestFunction function, AMFDataList params)
    {

    String stream = getParamString(params, PARAM1);
    MediaCasterStreamMap mediaCasterMap = m_appInstance.getMediaCasterStreams();

    if (!mediaCasterMap.getStreamManager().streamExists(stream))
    m_appInstance.startMediaCasterStream(stream, "liverepeater");

    try
    {
    Thread.sleep(5000);
    }
    catch (InterruptedException e)
    {
    e.printStackTrace();
    }

    invokePrevious(client, function, params);

    }
    Last edited by AlexeyTs; 04-23-2014 at 05:02 AM.

  5. #5

    Default

    So question now comes down to what is the event we need to wait for, before starting streaming to mag250 client, when stream is just started.

    And can it be fixed with some patch so no need in workarounds?

    OR, shell we try to change some settings on Origin?

    UPD:

    In a normal Edge environment, stream pulling from Origin will not be initialized until invokePrevious in Play()

    So waiting for an event is not an option, unless we manually start stream in Play(), and stop/destroy it when there are no clients for it left. It is basically re-doing what Edge is supposed to do, but with this delay added between stream start and streaming to client.

    Really need help.
    Last edited by AlexeyTs; 04-23-2014 at 05:12 AM.

  6. #6

    Default

    Ok. What kind of criteria can we use instead of Thread.sleep(10000) to be sure stream is absolutely ready, have a keyframe, and so on?


            public void play(IClient client, RequestFunction function, AMFDataList params)
    	{
    
    		String stream = getParamString(params, PARAM1);
    		MediaCasterStreamMap mediaCasterMap = m_appInstance.getMediaCasterStreams();
    
    		MediaCasterStreamItem mediaCasterItem = null;
    		boolean firstLaunch = false;
    
    		if (mediaCasterMap.getMediaCaster(stream) == null)
    		{
    
    			firstLaunch = true;
    			mediaCasterItem = mediaCasterMap.acquire(stream);
    
    			try
    			{
    				Thread.sleep(10000);
    			}
    			catch (InterruptedException e)
    			{
    				e.printStackTrace();
    			}
    
    		}
    
    		invokePrevious(client, function, params);
    
    		if (firstLaunch) mediaCasterItem.release();
    
    	}

  7. #7

    Default

    Hi,

    It sounds like the STB is possiby timing out its video playback as it has not received any video frames within a certain time after receiving audio, so it thinks it is an audio only stream. It will vary the amount of time to set up from the edge to the origin and it may also be a factor with the STB that it needs a keyframe quite soon after the connection (hard to say).

    The only real solution to this would be to have a barker style channel solution - so

    - Using the stream publisher api publish a file to an output stream - Hook 1
    - The STB can always connect to the output stream and it could show your logo or similar
    - When a connection is made to the output stream, this triggers the mediacaster API to get the stream from the origin
    - Using Hook1 switch the content from the barker content to the mediacaster stream to the output
    - Any new connections would just see the output channel as from the origin
    - When no one is watching the output drop back to the barker content and stop the mediacaster connection

    It is not too difficult to acheive but would take some work.

    Andrew.

  8. #8

    Default

    Hi Andrew,

    everything is clear, except the following:
    Quote Originally Posted by andrew_k View Post
    - Using Hook1 switch the content from the barker content to the mediacaster stream to the output
    How do we do it?

    Many thanks, Alex.

  9. #9
    Join Date
    Dec 2007
    Posts
    22,013

    Default

    The loop until live example will do that.

    Richard

  10. #10

    Default

    Quote Originally Posted by rrlanham View Post
    The loop until live example will do that.

    Richard
    Can we have some brief advice on how to do it using Java API, not a ready-made module? We would rather add it into our own module we are using already.

Page 1 of 2 12 LastLast

Similar Threads

  1. Memory usage issue with liverepeater origin-edge setup
    By yee.woon2@gmail.com in forum Live Streaming and Encoder Discussion
    Replies: 4
    Last Post: 07-27-2014, 02:21 PM
  2. Edge origin issue with server side modules
    By sutharshan02 in forum Live Streaming and Encoders
    Replies: 3
    Last Post: 03-19-2014, 06:54 AM
  3. RTMP dynamic streaming use nrgp thru Edge/Origin
    By andy_c in forum AddOn: Transcoder
    Replies: 11
    Last Post: 09-03-2013, 07:54 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
  •