diff --git a/channel.c b/channel.c index 51e171af00b8245308f13e956df23d83e3d96a35..51c89374b3f2864b46c97046409e595233d46942 100644 --- a/channel.c +++ b/channel.c @@ -3911,7 +3911,7 @@ static void copy_data_from_queue(struct ast_channel_spy_queue *queue, short *buf } tocopy = (f->samples > samples) ? samples : f->samples; - bytestocopy = ast_codec_get_len(queue->format, samples); + bytestocopy = ast_codec_get_len(queue->format, tocopy); memcpy(buf, f->data, bytestocopy); samples -= tocopy; buf += tocopy;