|
|
@ -2346,45 +2346,44 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr)
|
|
|
|
if (chan->tech->write == NULL)
|
|
|
|
if (chan->tech->write == NULL)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
/* XXX need to reindent this block */
|
|
|
|
/* Bypass translator if we're writing format in the raw write format. This
|
|
|
|
/* Bypass translator if we're writing format in the raw write format. This
|
|
|
|
allows mixing of native / non-native formats */
|
|
|
|
allows mixing of native / non-native formats */
|
|
|
|
if (fr->subclass == chan->rawwriteformat)
|
|
|
|
if (fr->subclass == chan->rawwriteformat)
|
|
|
|
f = fr;
|
|
|
|
f = fr;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
f = (chan->writetrans) ? ast_translate(chan->writetrans, fr, 0) : fr;
|
|
|
|
f = (chan->writetrans) ? ast_translate(chan->writetrans, fr, 0) : fr;
|
|
|
|
if (f == NULL) {
|
|
|
|
if (f == NULL) {
|
|
|
|
res = 0;
|
|
|
|
res = 0;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (chan->spies)
|
|
|
|
if (chan->spies)
|
|
|
|
queue_frame_to_spies(chan, f, SPY_WRITE);
|
|
|
|
queue_frame_to_spies(chan, f, SPY_WRITE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (chan->monitor && chan->monitor->write_stream) {
|
|
|
|
if (chan->monitor && chan->monitor->write_stream) {
|
|
|
|
#ifndef MONITOR_CONSTANT_DELAY
|
|
|
|
#ifndef MONITOR_CONSTANT_DELAY
|
|
|
|
int jump = chan->insmpl - chan->outsmpl - 4 * f->samples;
|
|
|
|
int jump = chan->insmpl - chan->outsmpl - 4 * f->samples;
|
|
|
|
if (jump >= 0) {
|
|
|
|
if (jump >= 0) {
|
|
|
|
if (ast_seekstream(chan->monitor->write_stream, jump + f->samples, SEEK_FORCECUR) == -1)
|
|
|
|
if (ast_seekstream(chan->monitor->write_stream, jump + f->samples, SEEK_FORCECUR) == -1)
|
|
|
|
ast_log(LOG_WARNING, "Failed to perform seek in monitoring write stream, synchronization between the files may be broken\n");
|
|
|
|
ast_log(LOG_WARNING, "Failed to perform seek in monitoring write stream, synchronization between the files may be broken\n");
|
|
|
|
chan->outsmpl += jump + 4 * f->samples;
|
|
|
|
chan->outsmpl += jump + 4 * f->samples;
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
chan->outsmpl += f->samples;
|
|
|
|
chan->outsmpl += f->samples;
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
int jump = chan->insmpl - chan->outsmpl;
|
|
|
|
int jump = chan->insmpl - chan->outsmpl;
|
|
|
|
if (jump - MONITOR_DELAY >= 0) {
|
|
|
|
if (jump - MONITOR_DELAY >= 0) {
|
|
|
|
if (ast_seekstream(chan->monitor->write_stream, jump - f->samples, SEEK_FORCECUR) == -1)
|
|
|
|
if (ast_seekstream(chan->monitor->write_stream, jump - f->samples, SEEK_FORCECUR) == -1)
|
|
|
|
ast_log(LOG_WARNING, "Failed to perform seek in monitoring write stream, synchronization between the files may be broken\n");
|
|
|
|
ast_log(LOG_WARNING, "Failed to perform seek in monitoring write stream, synchronization between the files may be broken\n");
|
|
|
|
chan->outsmpl += jump;
|
|
|
|
chan->outsmpl += jump;
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
chan->outsmpl += f->samples;
|
|
|
|
chan->outsmpl += f->samples;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
if (chan->monitor->state == AST_MONITOR_RUNNING) {
|
|
|
|
if (chan->monitor->state == AST_MONITOR_RUNNING) {
|
|
|
|
if (ast_writestream(chan->monitor->write_stream, f) < 0)
|
|
|
|
if (ast_writestream(chan->monitor->write_stream, f) < 0)
|
|
|
|
ast_log(LOG_WARNING, "Failed to write data to channel monitor write stream\n");
|
|
|
|
ast_log(LOG_WARNING, "Failed to write data to channel monitor write stream\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
res = chan->tech->write(chan, f);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
res = chan->tech->write(chan, f);
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|