Commit 71115380 authored by Simon Morlat's avatar Simon Morlat

add api to indicate when soundcard is going to be used/ will cease to be used.

parent 2ad38050
......@@ -95,8 +95,10 @@ typedef int (*MSSndCardGetControlFunc)(struct _MSSndCard *obj, MSSndCardControlE
typedef struct _MSFilter * (*MSSndCardCreateReaderFunc)(struct _MSSndCard *obj);
typedef struct _MSFilter * (*MSSndCardCreateWriterFunc)(struct _MSSndCard *obj);
typedef struct _MSSndCard * (*MSSndCardDuplicateFunc)(struct _MSSndCard *obj);
typedef void (*MSSndCardSetUsageHintFunc)(struct _MSSndCard *obj, bool_t is_going_to_be_used);
typedef void (*MSSndCardUnloadFunc)(MSSndCardManager *obj);
struct _MSSndCardDesc{
const char *driver_type;
MSSndCardDetectFunc detect;
......@@ -111,7 +113,7 @@ struct _MSSndCardDesc{
MSSndCardUninitFunc uninit;
MSSndCardDuplicateFunc duplicate;
MSSndCardUnloadFunc unload;
MSSndCardSetUsageHintFunc usage_hint;
......@@ -124,6 +126,7 @@ typedef struct _MSSndCardDesc MSSndCardDesc;
#define MS_SND_CARD_CAP_CAPTURE (1) /**<This sound card can capture sound */
#define MS_SND_CARD_CAP_PLAYBACK (1<<1) /**<This sound card can playback sound */
#define MS_SND_CARD_CAP_BUILTIN_ECHO_CANCELLER (1<<2) /**<This sound card has built-in echo cancellation*/
#define MS_SND_CARD_CAP_IS_SLOW (1<<3) /**<This sound card is very slow to start*/
struct _MSSndCard{
MSSndCardDesc *desc;
......@@ -457,6 +460,11 @@ MS2_PUBLIC int ms_snd_card_get_preferred_sample_rate(const MSSndCard *obj);
MS2_PUBLIC int ms_snd_card_set_preferred_sample_rate(MSSndCard *obj,int rate);
* Enable application to tell that the soundcard is going to be used or will cease to be used.
* This is recommended for cards which are known to be slow (see flag MS_SND_CARD_CAP_IS_SLOW ).
MS2_PUBLIC void ms_snd_card_set_usage_hint(MSSndCard *obj, bool_t is_going_to_be_used);
* Create a alsa card with user supplied pcm name and mixer name.
......@@ -223,6 +223,11 @@ struct _MSFilter * ms_snd_card_create_writer(MSSndCard *obj){
return NULL;
void ms_snd_card_set_usage_hint(MSSndCard *obj, bool_t is_going_to_be_used){
if (obj->desc->usage_hint!=NULL)
return obj->desc->usage_hint(obj, is_going_to_be_used);
void ms_snd_card_destroy(MSSndCard *obj){
if (obj->desc->uninit!=NULL) obj->desc->uninit(obj);
if (obj->name!=NULL) ms_free(obj->name);
......@@ -531,7 +531,12 @@ void media_stream_iterate(MediaStream *stream){
bool_t media_stream_alive(MediaStream *ms, int timeout){
const rtp_stats_t *stats=rtp_session_get_stats(ms->sessions.rtp_session);
const rtp_stats_t *stats;
if (ms->state!=MSStreamStarted){
return TRUE;
if (stats->recv!=0){
if (stats->recv!=ms->last_packet_count){
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