Lines Matching refs:buffer
49 void *buffer; // main buffer member
71 struct resampler_buffer* buffer) in echo_reference_get_next_buffer() argument
83 buffer->raw = NULL; in echo_reference_get_next_buffer()
84 buffer->frame_count = 0; in echo_reference_get_next_buffer()
88 buffer->frame_count = (buffer->frame_count > er->wr_frames_in) ? in echo_reference_get_next_buffer()
89 er->wr_frames_in : buffer->frame_count; in echo_reference_get_next_buffer()
91 buffer->i16 = (int16_t *)er->wr_src_buf + (er->wr_curr_frame_size - er->wr_frames_in) * in echo_reference_get_next_buffer()
98 struct resampler_buffer* buffer) in echo_reference_release_buffer() argument
109 er->wr_frames_in -= buffer->frame_count; in echo_reference_release_buffer()
115 free(er->buffer); in echo_reference_reset_l()
116 er->buffer = NULL; in echo_reference_reset_l()
134 struct echo_reference_buffer *buffer) in echo_reference_write() argument
145 if (buffer == NULL) { in echo_reference_write()
152 ALOGV("echo_reference_write() START trying to write %zu frames", buffer->frame_count); in echo_reference_write()
154 (int)buffer->time_stamp.tv_sec, in echo_reference_write()
155 (int)buffer->time_stamp.tv_nsec, er->playback_delay); in echo_reference_write()
160 if ((buffer->time_stamp.tv_sec == 0) && (buffer->time_stamp.tv_nsec == 0) && in echo_reference_write()
177 er->wr_render_time.tv_sec = buffer->time_stamp.tv_sec; in echo_reference_write()
178 er->wr_render_time.tv_nsec = buffer->time_stamp.tv_nsec; in echo_reference_write()
180 er->playback_delay = buffer->delay_ns; in echo_reference_write()
183 er->wr_curr_frame_size = buffer->frame_count; in echo_reference_write()
190 size_t wrBufSize = buffer->frame_count; in echo_reference_write()
192 inFrames = buffer->frame_count; in echo_reference_write()
195 inFrames = (buffer->frame_count * er->rd_sampling_rate) / er->wr_sampling_rate + in echo_reference_write()
213 int16_t *src16 = (int16_t *)buffer->raw; in echo_reference_write()
215 size_t frames = buffer->frame_count; in echo_reference_write()
246 er->wr_src_buf = buffer->raw; in echo_reference_write()
248 er->wr_frames_in = buffer->frame_count; in echo_reference_write()
261 inFrames = buffer->frame_count; in echo_reference_write()
262 srcBuf = buffer->raw; in echo_reference_write()
269 er->buffer = realloc(er->buffer, er->buf_size * er->rd_frame_size); in echo_reference_write()
271 memcpy((char *)er->buffer + er->frames_in * er->rd_frame_size, in echo_reference_write()
296 struct echo_reference_buffer *buffer) in echo_reference_read() argument
306 if (buffer == NULL) { in echo_reference_read()
314 buffer->delay_ns, er->frames_in, buffer->frame_count); in echo_reference_read()
323 memset(buffer->raw, 0, er->rd_frame_size * buffer->frame_count); in echo_reference_read()
324 buffer->delay_ns = 0; in echo_reference_read()
331 if (er->frames_in < buffer->frame_count) { in echo_reference_read()
332 uint32_t timeoutMs = (uint32_t)((1000 * buffer->frame_count) / er->rd_sampling_rate / 2); in echo_reference_read()
352 ALOGV_IF((er->frames_in < buffer->frame_count), in echo_reference_read()
355 timeoutMs, er->frames_in, buffer->frame_count); in echo_reference_read()
362 (buffer->time_stamp.tv_sec == 0 && buffer->time_stamp.tv_nsec == 0)) { in echo_reference_read()
367 if (buffer->time_stamp.tv_nsec < er->wr_render_time.tv_nsec) { in echo_reference_read()
368 tmp.tv_sec = buffer->time_stamp.tv_sec - er->wr_render_time.tv_sec - 1; in echo_reference_read()
369 tmp.tv_nsec = 1000000000 + buffer->time_stamp.tv_nsec - er->wr_render_time.tv_nsec; in echo_reference_read()
371 tmp.tv_sec = buffer->time_stamp.tv_sec - er->wr_render_time.tv_sec; in echo_reference_read()
372 tmp.tv_nsec = buffer->time_stamp.tv_nsec - er->wr_render_time.tv_nsec; in echo_reference_read()
376 int64_t expectedDelayNs = er->playback_delay + buffer->delay_ns - timeDiff; in echo_reference_read()
387 expectedDelayNs, er->playback_delay, buffer->delay_ns, timeDiff); in echo_reference_read()
421 er->buffer = realloc(er->buffer, er->buf_size * er->rd_frame_size); in echo_reference_read()
427 memset((char *)er->buffer + previousFrameIn * er->rd_frame_size, in echo_reference_read()
435 memcpy(er->buffer, (char *)er->buffer + (offset * er->rd_frame_size), in echo_reference_read()
452 expectedDelayNs, er->playback_delay, buffer->delay_ns, timeDiff); in echo_reference_read()
456 if (er->frames_in < buffer->frame_count) { in echo_reference_read()
457 if (buffer->frame_count > er->buf_size) { in echo_reference_read()
458 er->buf_size = buffer->frame_count; in echo_reference_read()
459 er->buffer = realloc(er->buffer, er->buf_size * er->rd_frame_size); in echo_reference_read()
463 memset((char *)er->buffer + er->frames_in * er->rd_frame_size, in echo_reference_read()
464 0, (buffer->frame_count - er->frames_in) * er->rd_frame_size); in echo_reference_read()
465 er->frames_in = buffer->frame_count; in echo_reference_read()
468 memcpy(buffer->raw, in echo_reference_read()
469 (char *)er->buffer, in echo_reference_read()
470 buffer->frame_count * er->rd_frame_size); in echo_reference_read()
472 er->frames_in -= buffer->frame_count; in echo_reference_read()
473 memcpy(er->buffer, in echo_reference_read()
474 (char *)er->buffer + buffer->frame_count * er->rd_frame_size, in echo_reference_read()
478 buffer->delay_ns = 0; in echo_reference_read()
481 buffer->frame_count, er->frames_in); in echo_reference_read()