Commit 87d793b2 authored by Ghislain MARY's avatar Ghislain MARY

Merge branch 'master' into dev_avpf

parents 4c4c8c1b a1775b14
......@@ -72,8 +72,8 @@ int ms_bitrate_driver_execute_action(MSBitrateDriver *obj, const MSRateControlAc
MSBitrateDriver * ms_bitrate_driver_ref(MSBitrateDriver *obj);
void ms_bitrate_driver_unref(MSBitrateDriver *obj);
MSBitrateDriver *ms_audio_bitrate_driver_new(MSFilter *encoder);
MSBitrateDriver *ms_av_bitrate_driver_new(MSFilter *a_encoder, MSFilter *venc);
MSBitrateDriver *ms_audio_bitrate_driver_new(RtpSession *session, MSFilter *encoder);
MSBitrateDriver *ms_av_bitrate_driver_new(RtpSession *asession, MSFilter *aenc, RtpSession *vsession, MSFilter *venc);
typedef struct _MSQosAnalyser MSQosAnalyser;
typedef struct _MSQosAnalyserDesc MSQosAnalyserDesc;
......
......@@ -71,7 +71,8 @@ MS2_PUBLIC void ring_stop (RingStream * stream);
/*
* Crypto suite used configure encrypted stream*/
typedef enum _MSCryptoSuite{
MS_AES_128_SHA1_80 = 1,
MS_CRYPTO_SUITE_INVALID=0,
MS_AES_128_SHA1_80,
MS_AES_128_SHA1_32,
MS_AES_128_NO_AUTH,
MS_NO_CIPHER_SHA1_80,
......@@ -79,6 +80,14 @@ typedef enum _MSCryptoSuite{
MS_AES_256_SHA1_32
} MSCryptoSuite;
typedef struct _MSCryptoSuiteNameParams{
const char *name;
const char *params;
}MSCryptoSuiteNameParams;
MS2_PUBLIC MSCryptoSuite ms_crypto_suite_build_from_name_params(const MSCryptoSuiteNameParams *nameparams);
MS2_PUBLIC int ms_crypto_suite_to_name_params(MSCryptoSuite cs, MSCryptoSuiteNameParams *nameparams);
typedef enum StreamType {
AudioStreamType,
VideoStreamType
......@@ -132,7 +141,7 @@ struct _MediaStream {
bool_t owns_sessions;
bool_t pad[1];
/**
* defines encoder target network bit rate, uses #media_stream_set_network_bitrate() setter.
* defines encoder target network bit rate, uses #media_stream_set_target_network_bitrate() setter.
* */
int target_bitrate;
media_stream_process_rtcp process_rtcp;
......
......@@ -104,6 +104,7 @@ static inline void ms_debug(const char *fmt,...)
typedef ortpTimeSpec MSTimeSpec;
#define ms_get_cur_time ortp_get_cur_time
#define ms_get_cur_time_ms ortp_get_cur_time_ms
struct _MSList {
struct _MSList *next;
......
......@@ -431,10 +431,19 @@ MS2_PUBLIC int ms_filter_call_method_noarg(MSFilter *f, unsigned int id);
* @param f A MSFilter object.
* @param id A method ID.
*
* Returns: 0 if successfull, -1 otherwise.
* Returns: TRUE if method is implemented, FALSE otherwise.
*/
MS2_PUBLIC bool_t ms_filter_has_method(MSFilter *f, unsigned int id);
/**
* Returns whether a filter implements a given interface.
* @param f a MSFilter object
* @param id an interface id.
*
* Returns TRUE if interface is implemented, FALSE, otherwise.
**/
bool_t ms_filter_implements_interface(MSFilter *f, MSFilterInterfaceId id);
/**
* Set a callback on filter's to be informed of private filter's event.
* This callback is called from the filter's MSTicker, unless a global event queue
......@@ -459,7 +468,6 @@ MS2_PUBLIC bool_t ms_filter_has_method(MSFilter *f, unsigned int id);
* @param fn A MSFilterNotifyFunc that will be called.
* @param userdata A pointer to private data.
* @param synchronous boolean that indicates whether this callback must be called synchronously.
* @deprecated use ms_filter_add_notify_callback()
*
*/
MS2_PUBLIC void ms_filter_add_notify_callback(MSFilter *f, MSFilterNotifyFunc fn, void *userdata, bool_t synchronous);
......
......@@ -282,15 +282,15 @@ static void compute_max_bitrate(OpusEncData *d, int ptimeStep) {
if (normalized_cbr<6000) {
int initial_value = normalized_cbr;
normalized_cbr = 6000;
d->max_network_bitrate = ((normalized_cbr*d->ptime/8000) + 12 + 8 + 20) *8000/d->ptime;
ms_warning("Opus encoder doesn't support bitrate [%i] set to 6kbps network bitrate [%d]", initial_value, d->max_network_bitrate);
d->max_network_bitrate = (normalized_cbr/(pps*8) + 12 + 8 + 20) *8*pps;
ms_warning("Opus encoder doesn't support bitrate [%i] set to 6kbps, network bitrate [%d]", initial_value, d->max_network_bitrate);
}
if (normalized_cbr>510000) {
int initial_value = normalized_cbr;
normalized_cbr = 510000;
d->max_network_bitrate = ((normalized_cbr*d->ptime/8000) + 12 + 8 + 20) *8000/d->ptime;
ms_warning("Opus encoder doesn't support bitrate [%i] set to 510kbps network bitrate [%d]", initial_value, d->max_network_bitrate);
d->max_network_bitrate = (normalized_cbr/(pps*8) + 12 + 8 + 20) *8*pps;
ms_warning("Opus encoder doesn't support bitrate [%i] set to 510kbps, network bitrate [%d]", initial_value, d->max_network_bitrate);
}
d->bitrate = normalized_cbr;
......@@ -375,6 +375,8 @@ static int ms_opus_enc_set_bitrate(MSFilter *f, void *arg) {
int bitrate = *((int *)arg); // the argument is the network bitrate requested
/* this function also manage the ptime, check if we are increasing or decreasing the bitrate in order to possibly decrease or increase ptime */
if (d->bitrate>0 && d->ptime>0) { /* at first call to set_bitrate(bitrate is initialised at -1), do not modify ptime, neither if it wasn't initialised too */
if (bitrate > d->max_network_bitrate ) {
......@@ -396,14 +398,16 @@ static int ms_opus_enc_set_bitrate(MSFilter *f, void *arg) {
ptimeStepValue = 20;
}
}
d->max_network_bitrate = bitrate;
ms_message("opus setbitrate to %d",d->max_network_bitrate);
ms_filter_lock(f);
compute_max_bitrate(d, ptimeStepValue*ptimeStepSign);
apply_max_bitrate(d);
ms_filter_unlock(f);
if (d->bitrate>0 && d->ptime>0) { /*don't apply bitrate before prepocess*/
ms_filter_lock(f);
compute_max_bitrate(d, ptimeStepValue*ptimeStepSign);
apply_max_bitrate(d);
ms_filter_unlock(f);
}
return 0;
}
......
......@@ -211,6 +211,10 @@ bool_t ms_filter_desc_implements_interface(MSFilterDesc *desc, MSFilterInterface
return FALSE;
}
bool_t ms_filter_implements_interface(MSFilter *f, MSFilterInterfaceId id){
return ms_filter_desc_implements_interface(f->desc,id);
}
MSList *ms_filter_lookup_by_interface(MSFilterInterfaceId id){
MSList *ret=NULL;
MSList *elem;
......
......@@ -296,9 +296,7 @@ static void remove_tasks_for_filter(MSTicker *ticker, MSFilter *f){
}
static uint64_t get_cur_time_ms(void *unused){
MSTimeSpec ts;
ms_get_cur_time(&ts);
return (ts.tv_sec*1000LL) + ((ts.tv_nsec+500000LL)/1000000LL);
return ms_get_cur_time_ms();
}
static void sleepMs(int ms){
......
......@@ -18,7 +18,11 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "mediastreamer-config.h"
#endif
#ifdef HAVE_X11_XLIB_H
#include "mediastreamer2/x11_helper.h"
#include "mediastreamer2/mscommon.h"
#include <ortp/port.h>
......
......@@ -278,7 +278,6 @@ static int msv4l2_do_mmap(V4l2State *s){
if (-1==v4l2_ioctl (s->fd, VIDIOC_QBUF, &buf)){
ms_error("VIDIOC_QBUF failed: %s",strerror(errno));
}else {
ms_debug("v4l2: queue buf %i",k);
inc_ref(s->frames[i]);
s->queued++;
}
......
......@@ -103,7 +103,11 @@ static void cut_audio_stream_graph(MSAudioEndpoint *ep, bool_t is_remote){
ep->out_cut_point=just_before(st->ms.encoder);
ms_filter_unlink(ep->out_cut_point.filter,ep->out_cut_point.pin,st->ms.encoder,0);
ms_filter_call_method(st->ms.rtpsend,MS_FILTER_GET_SAMPLE_RATE,&ep->samplerate);
if (ms_filter_has_method(st->ms.encoder,MS_FILTER_GET_SAMPLE_RATE)){
ms_filter_call_method(st->ms.encoder,MS_FILTER_GET_SAMPLE_RATE,&ep->samplerate);
}else{
ms_filter_call_method(st->ms.rtpsend,MS_FILTER_GET_SAMPLE_RATE,&ep->samplerate);
}
if (is_remote){
ep->mixer_in.filter=ep->in_cut_point_prev.filter;
......
......@@ -86,7 +86,11 @@ static void on_dtmf_received(RtpSession *s, int dtmf, void * user_data)
}
}
static void audio_stream_configure_resampler(MSFilter *resampler,MSFilter *from,MSFilter *to) {
/*
* note: since not all filters implement MS_FILTER_GET_SAMPLE_RATE, fallback_from_rate and fallback_to_rate are expected to provide sample rates
* obtained by another context, such as the RTP clock rate for example.
*/
static void audio_stream_configure_resampler(MSFilter *resampler,MSFilter *from, MSFilter *to, int fallback_from_rate, int fallback_to_rate) {
int from_rate=0, to_rate=0;
int from_channels = 0, to_channels = 0;
ms_filter_call_method(from,MS_FILTER_GET_SAMPLE_RATE,&from_rate);
......@@ -102,12 +106,12 @@ static void audio_stream_configure_resampler(MSFilter *resampler,MSFilter *from,
ms_error("Filter %s does not implement the MS_FILTER_GET_NCHANNELS method", to->desc->name);
}
if (from_rate == 0){
ms_error("Filter %s does not implement the MS_FILTER_GET_SAMPLE_RATE method, assuming 8000hz", from->desc->name);
from_rate=8000;
ms_error("Filter %s does not implement the MS_FILTER_GET_SAMPLE_RATE method", from->desc->name);
from_rate=fallback_from_rate;
}
if (to_rate == 0){
ms_error("Filter %s does not implement the MS_FILTER_GET_SAMPLE_RATE method, assuming 8000hz", from->desc->name);
to_rate=8000;
ms_error("Filter %s does not implement the MS_FILTER_GET_SAMPLE_RATE method", to->desc->name);
to_rate=fallback_to_rate;
}
ms_filter_call_method(resampler,MS_FILTER_SET_SAMPLE_RATE,&from_rate);
ms_filter_call_method(resampler,MS_FILTER_SET_OUTPUT_SAMPLE_RATE,&to_rate);
......@@ -360,14 +364,12 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
}else {
stream->soundread=ms_filter_new(MS_FILE_PLAYER_ID);
stream->read_resampler=ms_filter_new(MS_RESAMPLE_ID);
if (infile!=NULL) audio_stream_play(stream,infile);
}
if (playcard!=NULL) {
if (stream->soundwrite==NULL)
stream->soundwrite=ms_snd_card_create_writer(playcard);
}else {
stream->soundwrite=ms_filter_new(MS_FILE_REC_ID);
if (outfile!=NULL) audio_stream_record(stream,outfile);
}
/* creates the couple of encoder/decoder */
......@@ -444,6 +446,13 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
stream->volrecv=NULL;
audio_stream_enable_echo_limiter(stream,stream->el_type);
audio_stream_enable_noise_gate(stream,stream->use_ng);
if (ms_filter_implements_interface(stream->soundread,MSFilterPlayerInterface) && infile){
audio_stream_play(stream,infile);
}
if (ms_filter_implements_interface(stream->soundwrite,MSFilterPlayerInterface) && outfile){
audio_stream_record(stream,outfile);
}
if (stream->use_agc){
int tmp=1;
......@@ -512,6 +521,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
ms_message("Setting audio encoder network bitrate to [%i] on stream [%p]",stream->ms.target_bitrate,stream);
ms_filter_call_method(stream->ms.encoder,MS_FILTER_SET_BITRATE,&stream->ms.target_bitrate);
}
rtp_session_set_target_upload_bandwidth(stream->ms.sessions.rtp_session, stream->ms.target_bitrate);
ms_filter_call_method(stream->ms.encoder,MS_FILTER_SET_NCHANNELS,&nchannels);
ms_filter_call_method(stream->ms.decoder,MS_FILTER_SET_SAMPLE_RATE,&sample_rate);
ms_filter_call_method(stream->ms.decoder,MS_FILTER_SET_NCHANNELS,&nchannels);
......@@ -541,11 +551,11 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
/*configure resamplers if needed*/
if (stream->read_resampler){
audio_stream_configure_resampler(stream->read_resampler,stream->soundread,stream->ms.encoder);
audio_stream_configure_resampler(stream->read_resampler,stream->soundread,stream->ms.encoder,8000,pt->clock_rate);
}
if (stream->write_resampler){
audio_stream_configure_resampler(stream->write_resampler,stream->ms.decoder,stream->soundwrite);
audio_stream_configure_resampler(stream->write_resampler,stream->ms.decoder,stream->soundwrite,pt->clock_rate,8000);
}
if (stream->ms.use_rc){
......@@ -697,7 +707,9 @@ void audio_stream_play(AudioStream *st, const char *name){
if (name != NULL) {
ms_filter_call_method(st->soundread,MS_FILE_PLAYER_OPEN,(void*)name);
if (st->read_resampler){
audio_stream_configure_resampler(st->read_resampler,st->soundread,st->ms.rtpsend);
int fallback_to_rate=8000;
ms_filter_call_method(st->ms.rtpsend,MS_FILTER_GET_SAMPLE_RATE,&fallback_to_rate);
audio_stream_configure_resampler(st->read_resampler,st->soundread,st->ms.encoder, 8000, fallback_to_rate);
}
ms_filter_call_method_noarg(st->soundread,MS_FILE_PLAYER_START);
}
......
......@@ -133,13 +133,13 @@ void ms_bitrate_controller_destroy(MSBitrateController *obj){
MSBitrateController *ms_audio_bitrate_controller_new(RtpSession *session, MSFilter *encoder, unsigned int flags){
return ms_bitrate_controller_new(
ms_simple_qos_analyser_new(session),
ms_audio_bitrate_driver_new(encoder));
ms_audio_bitrate_driver_new(session, encoder));
}
MSBitrateController *ms_av_bitrate_controller_new(RtpSession *asession, MSFilter *aenc, RtpSession *vsession, MSFilter *venc){
return ms_bitrate_controller_new(
ms_simple_qos_analyser_new(vsession),
ms_av_bitrate_driver_new(aenc,venc));
ms_av_bitrate_driver_new(asession, aenc, vsession, venc));
}
......@@ -48,6 +48,7 @@ void ms_bitrate_driver_unref(MSBitrateDriver *obj){
struct _MSAudioBitrateDriver{
MSBitrateDriver parent;
RtpSession *session;
MSFilter *encoder;
int min_ptime;
int nom_bitrate;
......@@ -139,6 +140,8 @@ static int audio_bitrate_driver_execute_action(MSBitrateDriver *objbase, const M
if (ms_filter_call_method(obj->encoder,MS_FILTER_SET_BITRATE,&new_br)!=0){
ms_message("MSAudioBitrateDriver: SET_BITRATE failed, incrementing ptime");
return inc_ptime(obj);
} else {
rtp_session_set_target_upload_bandwidth(obj->session, new_br);
}
new_br=0;
ms_filter_call_method(obj->encoder,MS_FILTER_GET_BITRATE,&new_br);
......@@ -157,7 +160,10 @@ static int audio_bitrate_driver_execute_action(MSBitrateDriver *objbase, const M
ms_message("MSAudioBitrateDriver: increasing bitrate of codec to %i",obj->cur_bitrate);
if (ms_filter_call_method(obj->encoder,MS_FILTER_SET_BITRATE,&obj->cur_bitrate)!=0){
ms_message("MSAudioBitrateDriver: could not set codec bitrate to %i",obj->cur_bitrate);
}else obj->cur_bitrate=obj->nom_bitrate; /* so that we do not attempt this anymore*/
}else {
rtp_session_set_target_upload_bandwidth(obj->session, obj->cur_bitrate);
obj->cur_bitrate=obj->nom_bitrate; /* so that we do not attempt this anymore*/
}
return 0;
}
}else ms_warning("MSAudioBitrateDriver: MS_FILTER_GET_BITRATE failed.");
......@@ -181,9 +187,10 @@ static MSBitrateDriverDesc audio_bitrate_driver={
};
MSBitrateDriver *ms_audio_bitrate_driver_new(MSFilter *encoder){
MSBitrateDriver *ms_audio_bitrate_driver_new(RtpSession *session, MSFilter *encoder){
MSAudioBitrateDriver *obj=ms_new0(MSAudioBitrateDriver,1);
obj->parent.desc=&audio_bitrate_driver;
obj->session = session;
obj->encoder=encoder;
obj->min_ptime=20;
obj->cur_ptime=0;
......@@ -196,6 +203,7 @@ static const int min_video_bitrate=64000;
typedef struct _MSAVBitrateDriver{
MSBitrateDriver parent;
MSBitrateDriver *audio_driver;
RtpSession *vsession;
MSFilter *venc;
int nom_bitrate;
int cur_bitrate;
......@@ -212,6 +220,7 @@ static int dec_video_bitrate(MSAVBitrateDriver *obj, const MSRateControlAction *
}
ms_message("MSAVBitrateDriver: targeting %i bps for video encoder.",new_br);
ms_filter_call_method(obj->venc,MS_FILTER_SET_BITRATE,&new_br);
rtp_session_set_target_upload_bandwidth(obj->vsession, new_br);
obj->cur_bitrate=new_br;
return new_br==min_video_bitrate ? -1 : 0;
}
......@@ -229,6 +238,7 @@ static int inc_video_bitrate(MSAVBitrateDriver *obj, const MSRateControlAction *
obj->cur_bitrate=newbr;
ms_message("MSAVBitrateDriver: increasing bitrate to %i bps for video encoder.",obj->cur_bitrate);
ms_filter_call_method(obj->venc,MS_FILTER_SET_BITRATE,&obj->cur_bitrate);
rtp_session_set_target_upload_bandwidth(obj->vsession, obj->cur_bitrate);
return ret;
}
......@@ -273,10 +283,11 @@ static MSBitrateDriverDesc av_bitrate_driver={
av_bitrate_driver_uninit
};
MSBitrateDriver *ms_av_bitrate_driver_new(MSFilter *aenc, MSFilter *venc){
MSBitrateDriver *ms_av_bitrate_driver_new(RtpSession *asession, MSFilter *aenc, RtpSession *vsession, MSFilter *venc){
MSAVBitrateDriver *obj=ms_new0(MSAVBitrateDriver,1);
obj->parent.desc=&av_bitrate_driver;
obj->audio_driver=(aenc!=NULL) ? ms_bitrate_driver_ref(ms_audio_bitrate_driver_new(aenc)) : NULL;
obj->audio_driver=((asession != NULL) && (aenc!=NULL)) ? ms_bitrate_driver_ref(ms_audio_bitrate_driver_new(asession, aenc)) : NULL;
obj->vsession = vsession;
obj->venc=venc;
return (MSBitrateDriver*)obj;
......
......@@ -276,7 +276,7 @@ static int check_srtp_session_created(MediaStream *stream){
return 0;
}
static bool_t add_srtp_stream(srtp_t srtp, MSCryptoSuite suite, uint32_t ssrc, const char* b64_key, bool_t inbound)
static int add_srtp_stream(srtp_t srtp, MSCryptoSuite suite, uint32_t ssrc, const char* b64_key, bool_t inbound)
{
srtp_policy_t policy;
uint8_t* key;
......@@ -314,6 +314,9 @@ static bool_t add_srtp_stream(srtp_t srtp, MSCryptoSuite suite, uint32_t ssrc, c
crypto_policy_set_aes_cm_256_hmac_sha1_32(&policy.rtp);
crypto_policy_set_aes_cm_256_hmac_sha1_32(&policy.rtcp);
break;
case MS_CRYPTO_SUITE_INVALID:
return -1;
break;
}
key_size = b64_decode(b64_key, b64_key_length, 0, 0);
if (key_size != policy.rtp.cipher_key_len) {
......@@ -555,3 +558,65 @@ bool_t media_stream_is_secured (const MediaStream *stream) {
MSStreamState media_stream_get_state(const MediaStream *stream) {
return stream->state;
}
#define keywordcmp(key,b) strncmp(key,b,sizeof(key))
/* see http://www.iana.org/assignments/sdp-security-descriptions/sdp-security-descriptions.xhtml#sdp-security-descriptions-3 */
MSCryptoSuite ms_crypto_suite_build_from_name_params(const MSCryptoSuiteNameParams *descrption){
const char *name=descrption->name, *parameters=descrption->params;
if (keywordcmp ( "AES_CM_128_HMAC_SHA1_80",name ) == 0 ){
if (parameters && strstr(parameters,"UNENCRYPTED_SRTP")) return MS_NO_CIPHER_SHA1_80;
else if (parameters && strstr(parameters,"UNAUTHENTICATED_SRTP")) return MS_AES_128_NO_AUTH;
else return MS_AES_128_SHA1_80;
}else if ( keywordcmp ( "AES_CM_128_HMAC_SHA1_32",name ) == 0 ){
if (parameters && strstr(parameters,"UNENCRYPTED_SRTP")) goto error;
if (parameters && strstr(parameters,"UNAUTHENTICATED_SRTP")) return MS_AES_128_NO_AUTH;
else return MS_AES_128_SHA1_32;
}else if ( keywordcmp ( "AES_CM_256_HMAC_SHA1_32",name ) == 0 ){
if (parameters && strstr(parameters,"UNENCRYPTED_SRTP")) goto error;
if (parameters && strstr(parameters,"UNAUTHENTICATED_SRTP")) goto error;
return MS_AES_256_SHA1_32;
}else if ( keywordcmp ( "AES_CM_256_HMAC_SHA1_80",name ) == 0 ){
if (parameters && strstr(parameters,"UNENCRYPTED_SRTP")) goto error;
if (parameters && strstr(parameters,"UNAUTHENTICATED_SRTP")) goto error;
return MS_AES_256_SHA1_80;
}
error:
ms_error("Unsupported crypto suite '%s' with parameters '%s'",name, parameters ? parameters : "");
return MS_CRYPTO_SUITE_INVALID;
}
int ms_crypto_suite_to_name_params(MSCryptoSuite cs, MSCryptoSuiteNameParams *params ){
params->name=NULL;
params->params=NULL;
switch(cs){
case MS_CRYPTO_SUITE_INVALID:
break;
case MS_AES_128_SHA1_80:
params->name= "AES_CM_128_HMAC_SHA1_80";
break;
case MS_AES_128_SHA1_32:
params->name="AES_CM_128_HMAC_SHA1_32";
break;
case MS_AES_128_NO_AUTH:
params->name="AES_CM_128_HMAC_SHA1_80";
params->params="UNAUTHENTICATED_SRTP";
break;
case MS_NO_CIPHER_SHA1_80:
params->name="AES_CM_128_HMAC_SHA1_80";
params->params="UNENCRYPTED_SRTP UNENCRYPTED_SRTCP";
break;
case MS_AES_256_SHA1_80:
params->name="AES_CM_256_HMAC_SHA1_80";
break;
case MS_AES_256_SHA1_32:
params->name="AES_CM_256_HMAC_SHA1_32";
break;
}
if (params->name==NULL) return -1;
return 0;
}
......@@ -66,7 +66,6 @@ void ms_qos_analyser_unref(MSQosAnalyser *obj){
#define STATS_HISTORY 3
static const float unacceptable_loss_rate=10;
static const int big_jitter=10; /*ms */
static const float significant_delay=0.2; /*seconds*/
......
......@@ -454,6 +454,7 @@ int video_stream_start (VideoStream *stream, RtpProfile *profile, const char *re
} else {
ms_filter_call_method(stream->ms.encoder, MS_FILTER_SET_BITRATE, &pt->normal_bitrate);
}
rtp_session_set_target_upload_bandwidth(stream->ms.sessions.rtp_session, pt->normal_bitrate);
}
if (pt->send_fmtp){
ms_filter_call_method(stream->ms.encoder,MS_FILTER_ADD_FMTP,pt->send_fmtp);
......
......@@ -114,6 +114,7 @@ typedef struct _MediastreamDatas {
bool_t enable_srtp;
bool_t interactive;
bool_t enable_avpf;
bool_t enable_rtcp;
bool_t pad;
float el_speed;
float el_thres;
......@@ -212,7 +213,8 @@ const char *usage="mediastream --local <port> --remote <ip:port> \n"
"[ --mtu <mtu> (specify MTU)]\n"
"[ --interactive (run in interactive mode)]\n"
"[ --no-avpf]\n"
;
"[ --no-rtcp]\n"
;
#if TARGET_OS_IPHONE
int g_argc;
......@@ -306,6 +308,7 @@ MediastreamDatas* init_default_args() {
args->video_window_id = -1;
args->preview_window_id = -1;
args->enable_avpf = TRUE;
args->enable_rtcp = TRUE;
/* starting values echo canceller */
args->ec_len_ms=args->ec_delay_ms=args->ec_framesize=0;
args->enable_srtp = FALSE;
......@@ -508,18 +511,19 @@ bool_t parse_args(int argc, char** argv, MediastreamDatas* out) {
ms_error("Invalid zoom triplet");
return FALSE;
}
}else if (strcmp(argv[i],"--mtu")==0){
} else if (strcmp(argv[i],"--mtu")==0){
i++;
if (sscanf(argv[i], "%i", &out->mtu) != 1) {
ms_error("Invalid mtu value");
return FALSE;
}
}else if (strcmp(argv[i],"--interactive")==0){
} else if (strcmp(argv[i],"--interactive")==0){
out->interactive=TRUE;
} else if (strcmp(argv[i], "--no-avpf") == 0) {
out->enable_avpf = FALSE;
}
else if (strcmp(argv[i],"--help")==0){
} else if (strcmp(argv[i], "--no-rtcp") == 0) {
out->enable_rtcp = FALSE;
} else if (strcmp(argv[i],"--help")==0){
printf("%s",usage);
return FALSE;
}
......@@ -659,7 +663,7 @@ void setup_media_streams(MediastreamDatas* args) {
audio_stream_enable_adaptive_bitrate_control(args->audio,args->use_rc);
printf("Starting audio stream.\n");
audio_stream_start_full(args->audio,args->profile,args->ip,args->remoteport,args->ip,args->remoteport+1, args->payload, args->jitter,args->infile,args->outfile,
audio_stream_start_full(args->audio,args->profile,args->ip,args->remoteport,args->ip,args->enable_rtcp?args->remoteport+1:-1, args->payload, args->jitter,args->infile,args->outfile,
args->outfile==NULL ? play : NULL ,args->infile==NULL ? capt : NULL,args->infile!=NULL ? FALSE: args->ec);
if (args->ice_local_candidates_nb || args->ice_remote_candidates_nb) {
......@@ -767,7 +771,7 @@ void setup_media_streams(MediastreamDatas* args) {
cam=ms_web_cam_manager_get_default_cam(ms_web_cam_manager_get());
video_stream_start(args->video,args->profile,
args->ip,args->remoteport,
args->ip,args->remoteport+1,
args->ip,args->enable_rtcp?args->remoteport+1:-1,
args->payload,
args->jitter,cam
);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment