Loop option implementation in conference member play

This commit is contained in:
Saurabh 2021-11-08 20:11:12 +05:30 committed by GitHub
parent f2a7891f14
commit b15ffd9e7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 1 deletions

View File

@ -604,7 +604,20 @@ void conference_member_add_file_data(conference_member_t *member, int16_t *data,
}
if (file_sample_len <= 0) {
if (member->fnode->loops) {
if (--member->fnode->loops < 0) {
member->fnode->loops = -1;
}
if (member->fnode->loops) {
uint32_t pos = 0;
switch_core_file_seek(&member->fnode->fh, &pos, 0, SEEK_SET);
}
}
if (!member->fnode->loops) {
member->fnode->done++;
}
} else { /* there is file node data to mix into the frame */
uint32_t i;
int32_t sample;
@ -1500,6 +1513,7 @@ switch_status_t conference_member_play_file(conference_member_t *member, char *f
if (fnode->fh.params) {
const char *vol = switch_event_get_header(fnode->fh.params, "vol");
const char *loopsstr = switch_event_get_header(fnode->fh.params, "loops");
const char *position = switch_event_get_header(fnode->fh.params, "position");
if (!zstr(vol)) {
@ -1507,6 +1521,14 @@ switch_status_t conference_member_play_file(conference_member_t *member, char *f
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_DEBUG, "Set playback volume for file: %d\n",fnode->fh.vol);
}
if (loopsstr) {
fnode->loops = atoi(loopsstr);
if (!strcasecmp(loopsstr, "inf") || !strcasecmp(loopsstr, "infinite")) {
fnode->loops = -1;
}
}
if (!bad_params && !zstr(position) && member->conference->channels == 2) {
fnode->al = conference_al_create(pool);
if (conference_al_parse_position(fnode->al, position) != SWITCH_STATUS_SUCCESS) {