diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-01-21 21:27:17 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-01-21 21:27:17 +0000 |
commit | b9e8f8b81a47c54240abcc03777175babe1f3d54 (patch) | |
tree | 36534dc9ed9dea4ebdee48155f521b38e711d78c | |
parent | cdc6f35e7d0ee488e9875151f6c077b395f838b9 (diff) |
Add optional one way playback (bug #3397)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4871 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-x | channels/chan_oss.c | 9 | ||||
-rwxr-xr-x | configs/oss.conf.sample | 7 |
2 files changed, 14 insertions, 2 deletions
diff --git a/channels/chan_oss.c b/channels/chan_oss.c index 4e4b4aa58..0219e360d 100755 --- a/channels/chan_oss.c +++ b/channels/chan_oss.c @@ -70,6 +70,7 @@ static struct timeval lasttime; static int usecnt; static int silencesuppression = 0; static int silencethreshold = 1000; +static int playbackonly = 0; AST_MUTEX_DEFINE_STATIC(usecnt_lock); @@ -565,9 +566,11 @@ static int oss_write(struct ast_channel *chan, struct ast_frame *f) return 0; /* Stop any currently playing sound */ cursound = -1; - if (!full_duplex) { + if (!full_duplex && !playbackonly) { /* If we're half duplex, we have to switch to read mode - to honor immediate needs if necessary */ + to honor immediate needs if necessary. But if we are in play + back only mode, then we don't switch because the console + is only being used one way -- just to playback something. */ res = soundcard_setinput(1); if (res < 0) { ast_log(LOG_WARNING, "Unable to set device to input mode\n"); @@ -1038,6 +1041,8 @@ int load_module() strncpy(language, v->value, sizeof(language)-1); else if (!strcasecmp(v->name, "extension")) strncpy(exten, v->value, sizeof(exten)-1); + else if (!strcasecmp(v->name, "playbackonly")) + playbackonly = ast_true(v->value); v=v->next; } ast_destroy(cfg); diff --git a/configs/oss.conf.sample b/configs/oss.conf.sample index 25c89ab4b..9d605ceb5 100755 --- a/configs/oss.conf.sample +++ b/configs/oss.conf.sample @@ -25,3 +25,10 @@ extension=s ; but your mileage may vary. Use the echo test to evaluate the best setting. ;silencesuppression = yes ;silencethreshold = 1000 +; +; On half-duplex cards, the driver attempts to switch back and forth between +; read and write modes. Unfortunately, this fails sometimes on older hardware. +; To prevent the driver from switching (ie. only play files on your speakers), +; then set the playbackonly option to yes. Default is no. Note this option has +; no effect on full-duplex cards. +;playbackonly=no |