mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-03 12:25:35 +00:00
Fix a few places where frame data was used directly.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@117828 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -484,7 +484,7 @@ static int queue_voice_frame(struct jack_data *jack_data, struct ast_frame *f)
|
|||||||
float f_buf[f->samples * 8];
|
float f_buf[f->samples * 8];
|
||||||
size_t f_buf_used = 0;
|
size_t f_buf_used = 0;
|
||||||
int i;
|
int i;
|
||||||
int16_t *s_buf = f->data;
|
int16_t *s_buf = f->data.ptr;
|
||||||
size_t res;
|
size_t res;
|
||||||
|
|
||||||
memset(f_buf, 0, sizeof(f_buf));
|
memset(f_buf, 0, sizeof(f_buf));
|
||||||
@@ -572,7 +572,7 @@ static void handle_jack_audio(struct ast_channel *chan, struct jack_data *jack_d
|
|||||||
.frametype = AST_FRAME_VOICE,
|
.frametype = AST_FRAME_VOICE,
|
||||||
.subclass = AST_FORMAT_SLINEAR,
|
.subclass = AST_FORMAT_SLINEAR,
|
||||||
.src = "JACK",
|
.src = "JACK",
|
||||||
.data = buf,
|
.data.ptr = buf,
|
||||||
.datalen = sizeof(buf),
|
.datalen = sizeof(buf),
|
||||||
.samples = ARRAY_LEN(buf),
|
.samples = ARRAY_LEN(buf),
|
||||||
};
|
};
|
||||||
@@ -582,7 +582,7 @@ static void handle_jack_audio(struct ast_channel *chan, struct jack_data *jack_d
|
|||||||
char *read_buf;
|
char *read_buf;
|
||||||
|
|
||||||
read_len = out_frame ? out_frame->datalen : sizeof(buf);
|
read_len = out_frame ? out_frame->datalen : sizeof(buf);
|
||||||
read_buf = out_frame ? out_frame->data : buf;
|
read_buf = out_frame ? out_frame->data.ptr : buf;
|
||||||
|
|
||||||
res = jack_ringbuffer_read_space(jack_data->input_rb);
|
res = jack_ringbuffer_read_space(jack_data->input_rb);
|
||||||
|
|
||||||
@@ -590,7 +590,7 @@ static void handle_jack_audio(struct ast_channel *chan, struct jack_data *jack_d
|
|||||||
/* Not enough data ready for another frame, move on ... */
|
/* Not enough data ready for another frame, move on ... */
|
||||||
if (out_frame) {
|
if (out_frame) {
|
||||||
ast_debug(1, "Sending an empty frame for the JACK_HOOK\n");
|
ast_debug(1, "Sending an empty frame for the JACK_HOOK\n");
|
||||||
memset(out_frame->data, 0, out_frame->datalen);
|
memset(out_frame->data.ptr, 0, out_frame->datalen);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ static struct ast_frame *lintospeex_sample(void)
|
|||||||
f.mallocd = 0;
|
f.mallocd = 0;
|
||||||
f.offset = 0;
|
f.offset = 0;
|
||||||
f.src = __PRETTY_FUNCTION__;
|
f.src = __PRETTY_FUNCTION__;
|
||||||
f.data = slin_speex_ex;
|
f.data.ptr = slin_speex_ex;
|
||||||
return &f;
|
return &f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +180,7 @@ static struct ast_frame *speextolin_sample(void)
|
|||||||
f.mallocd = 0;
|
f.mallocd = 0;
|
||||||
f.offset = 0;
|
f.offset = 0;
|
||||||
f.src = __PRETTY_FUNCTION__;
|
f.src = __PRETTY_FUNCTION__;
|
||||||
f.data = speex_slin_ex;
|
f.data.ptr = speex_slin_ex;
|
||||||
return &f;
|
return &f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,7 +220,7 @@ static int speextolin_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Read in bits */
|
/* Read in bits */
|
||||||
speex_bits_read_from(&tmp->bits, f->data, f->datalen);
|
speex_bits_read_from(&tmp->bits, f->data.ptr, f->datalen);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
#ifdef _SPEEX_TYPES_H
|
#ifdef _SPEEX_TYPES_H
|
||||||
res = speex_decode_int(tmp->speex, &tmp->bits, fout);
|
res = speex_decode_int(tmp->speex, &tmp->bits, fout);
|
||||||
@@ -249,7 +249,7 @@ static int lintospeex_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
|
|||||||
/* XXX We should look at how old the rest of our stream is, and if it
|
/* XXX We should look at how old the rest of our stream is, and if it
|
||||||
is too old, then we should overwrite it entirely, otherwise we can
|
is too old, then we should overwrite it entirely, otherwise we can
|
||||||
get artifacts of earlier talk that do not belong */
|
get artifacts of earlier talk that do not belong */
|
||||||
memcpy(tmp->buf + pvt->samples, f->data, f->datalen);
|
memcpy(tmp->buf + pvt->samples, f->data.ptr, f->datalen);
|
||||||
pvt->samples += f->samples;
|
pvt->samples += f->samples;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ static int ogg_vorbis_write(struct ast_filestream *fs, struct ast_frame *f)
|
|||||||
if (!f->datalen)
|
if (!f->datalen)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
data = (short *) f->data;
|
data = (short *) f->data.ptr;
|
||||||
|
|
||||||
buffer = vorbis_analysis_buffer(&s->vd, f->samples);
|
buffer = vorbis_analysis_buffer(&s->vd, f->samples);
|
||||||
|
|
||||||
@@ -433,7 +433,7 @@ static struct ast_frame *ogg_vorbis_read(struct ast_filestream *fs,
|
|||||||
fs->fr.subclass = AST_FORMAT_SLINEAR;
|
fs->fr.subclass = AST_FORMAT_SLINEAR;
|
||||||
fs->fr.mallocd = 0;
|
fs->fr.mallocd = 0;
|
||||||
AST_FRAME_SET_BUFFER(&fs->fr, fs->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
|
AST_FRAME_SET_BUFFER(&fs->fr, fs->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
|
||||||
buf = (short *)(fs->fr.data); /* SLIN data buffer */
|
buf = (short *)(fs->fr.data.ptr); /* SLIN data buffer */
|
||||||
|
|
||||||
while (samples_out != SAMPLES_MAX) {
|
while (samples_out != SAMPLES_MAX) {
|
||||||
float **pcm;
|
float **pcm;
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ static int speex_callback(struct ast_audiohook *audiohook, struct ast_channel *c
|
|||||||
speex_preprocess_ctl(sdi->state, SPEEX_PREPROCESS_SET_DENOISE, &sdi->denoise);
|
speex_preprocess_ctl(sdi->state, SPEEX_PREPROCESS_SET_DENOISE, &sdi->denoise);
|
||||||
}
|
}
|
||||||
|
|
||||||
speex_preprocess(sdi->state, frame->data, NULL);
|
speex_preprocess(sdi->state, frame->data.ptr, NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user