Results 1 to 8 of 8

Thread: Limit publish bandwidth - once again

  1. #1

    Default Limit publish bandwidth - once again

    Hi,

    I know there is a lot of this subject in here... But I bet that in the past I used some kind of ready made module that automaticaly disconnected FMLE if the total bandwidth (audio+video) was bigger than the limit imposed by a property in the Application.xml.

    The ModuleLimitPublishedStreamBandwidth works very bad.
    Even if I setup FMLE to publish at 400kbps maximum, sometimes it goes over that value and get disconnected by wowza.

    Is there some ready compiled module better than that? Like I described in the begining of this post..
    If Wowza is configured to accept 400kbps maximum and if FMLE starts publish with the configuration of 401kbps, it will be unable to publish.

    Thanks.

  2. #2
    Join Date
    Jun 2012
    Posts
    723

    Default

    Hi,

    If you set the ModuleLimitPublishedStreamBandwidth module to only allow a maximum publishing rate of 400kbps and the stream goes above that limit, it is an expected behavior to drop that connection.
    If you see that your encoder has a fluctuating stream, which is quite common for encoders, you should increase the allowed bitrate to allow more room for the variable bitrate the encoder sends.
    In your particular case, maybe it would be a good idea to set the maximum allowed published bitrate to 450kbps.

    Zoran

  3. #3

    Default

    Ok, But I think the module was more accurate if it take use of the parameters sent by the Encoder.

    Let's see:

    2013-10-03 13:38:32 WEST publish stream INFO 200 stream2 - _defaultVHost_ live _definst_ 0.08 [any] 1935 rtmp://MYIP/live 192.168.xxx.xxx rtmp rtmp://MYIP/live FMLE/3.0 (compatible; FMSc/1.0) 239824009 3524 3615 1 0 00 stream2 videoKeyframeFrequency=5&totalDatarate=400 - - - - rtmp://MYIP/live/stream2?videoKeyframeFrequency=5&totalDatarate=400 rtmp://MYIP/live/stream2 videoKeyframeFrequency=5&totalDatarate=400 rtmp://MYIP/live

    Was a perfect module (IMHO) if it reads that value (in RED) and could publish or not depending the maximum we have set in configurations.

    Is there the possibility to post here a quick java code so I can compile?

    Thanks.

  4. #4

    Default

    I'm almost doing a module like the one I described.... But ... I'm having some dificulties:

    MODULE:

    package com.wowza;
    import com.wowza.wms.application.*;
    import com.wowza.wms.amf.*;
    import com.wowza.wms.client.*;
    import com.wowza.wms.module.*;
    import com.wowza.wms.request.*;

    public class MyOwnModule extends ModuleBase
    {
    public void onAppStart(IApplicationInstance appInstance)
    {
    String splitThis = (String) appInstance.getProperties().getProperty("MaxValueKb");
    String[] someListArray = splitThis.split(",");
    getLogger().info("MAXIMUM BANDWIDTH: " + someListArray[0]);
    }


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

    string PARAMETERS = getParamString(params, PARAM1);

    GET THE totalDatarate=400 from PARAM1

    if the value <= MaxValueKb
    {
    Publish The Stream
    }
    else
    {
    client.rejectConnection();
    }

    }

    }


    I can't do the RED code... any help would be appreciated

  5. #5
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    First, what you are trying to do might not work, the data you need about the published stream is probably not available at that time. In any case, the way to publish or not is whether you do invokePrevious() or not, and you should do the same in releaseStream:

    	public void publish(IClient client, RequestFunction function,
    	        AMFDataList params) {
    		getLogger().info("Overriding Publish");
    		
    		Boolean doit = true;
    		
    		if (doit)
    			invokePrevious(client, function, params);
    	}
    
    public void releaseStream(IClient client, RequestFunction function, AMFDataList params)
    	{
    	Boolean doit = true;
    	
    	if (doit)
    		invokePrevious(client, function, params);		
    	}
    Take a look at this example for monitoring bandwidth of a live stream

    Richard

  6. #6

    Default

    I'm almost there.... But can't publish..



    package com.wowza;
    import com.wowza.wms.application.*;
    import com.wowza.wms.amf.*;
    import com.wowza.wms.client.*;
    import com.wowza.wms.module.*;
    import com.wowza.wms.request.*;

    public class MyOwnModule extends ModuleBase
    {
    public void onAppStart(IApplicationInstance appInstance)
    {
    String MAX= (String) appInstance.getProperties().getProperty("MaxValueKb");
    getLogger().info("MAXIMUM BANDWIDTH ALLOWED: " + MAX);
    }

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

    String somevalue = null;
    String[] BandwidthFromPublisher = getParamString(params, PARAM1).split("=");

    somevalue = BandwidthFromPublisher[2];

    getLogger().info("Total DataRate from Publisher: " + somevalue + " kbps");
    // TRANSFORM THE VARIABLE somevalue TO int
    int x = Integer.parseInt(somevalue);
    if (x <= 400)
    {
    getLogger().info("SUCCESS!!!!!!!!!!");
    client.acceptConnection();
    }
    else
    {
    client.rejectConnection();
    getLogger().info("FAIL!!!!!!!");
    }
    }
    }

    PS: The 400 value in RED was supposed to be gathered from the MAX variable.

    Any help?

  7. #7
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    You cannot do client.rejectConnection() after connect is accepted in onConnect().

    You have to do client.setShutdown(true)

    You will also have to do invokePrevious() when you want to continue publishing.

    Richard
    Last edited by rrlanham; 10-03-2013 at 12:13 PM.

  8. #8

    Default

    Thank you Richard.

    The module is done. Working fine. Compiled and running.


    Unfortunately, it does not work with WireCast. But works like a charm on FMLE.
    It's better to run this module with the other module: ModuleLimitPublishedStreamBandwidth to make sure that people that are using WireCast can not do an overload.

    Thank you.
    Last edited by eluis2011; 10-04-2013 at 07:10 AM.

Similar Threads

  1. Limit Bandwidth
    By kleberrvf in forum General Forum
    Replies: 1
    Last Post: 02-29-2012, 12:34 PM
  2. Limit download bandwidth
    By koobos in forum Live Streaming and Encoder Discussion
    Replies: 7
    Last Post: 11-04-2011, 08:33 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
  •