Lines Matching refs:buffer
136 // written to buffer (other flags are cleared)
194 void AudioFlinger::ThreadBase::TrackBase::releaseBuffer(AudioBufferProvider::Buffer* buffer)
198 (void) mTeeSink->write(buffer->raw, buffer->frameCount);
202 buffer->raw = NULL;
203 mStepCount = buffer->frameCount;
206 buffer->frameCount = 0;
240 "TrackBase::getBuffer buffer out of range:\n"
299 sp<IMemory>* buffer) {
305 return tt->allocateTimedBuffer(size, buffer);
308 status_t AudioFlinger::TrackHandle::queueTimedBuffer(const sp<IMemory>& buffer,
315 return tt->queueTimedBuffer(buffer, pts);
438 void AudioFlinger::PlaybackThread::Track::dump(char* buffer, size_t size)
442 sprintf(buffer, " F %2d", mFastIndex);
444 sprintf(buffer, " %4d", mName - AudioMixer::TRACK0);
498 snprintf(&buffer[7], size-7, " %6d %4u %3u 0x%08x %7u %6u %6u %1c %1d %5u %5.2g %5.2g "
523 AudioBufferProvider::Buffer* buffer, int64_t pts)
527 uint32_t framesReq = buffer->frameCount;
558 buffer->raw = getBuffer(s, framesReq);
559 buffer->frameCount = framesReq;
564 buffer->raw = NULL;
565 buffer->frameCount = 0;
733 // written to buffer
793 void AudioFlinger::PlaybackThread::Track::setAuxBuffer(int EffectId, int32_t *buffer)
796 mAuxBuffer = buffer;
804 // first time (mPresentationCompleteFrames == 0) plus the buffer filling status at that time.
944 size_t size, sp<IMemory>* buffer) {
967 *buffer = newBuffer;
998 // We have a next buffer. Just use its PTS as the PTS of the frame
999 // following the last frame in this buffer. If the stream is sparse
1002 // in one extra buffer being left un-trimmed when it could have
1008 // We have no next buffer. Compute the PTS of the frame following
1009 // the last frame in this buffer by computing the duration of of
1011 // buffer.
1012 int64_t frameCount = mTimedBufferQueue[trimEnd].buffer()->size()
1031 // Is the buffer we want to use in the middle of a mix operation right
1054 "%s called (reason \"%s\"), but timed buffer queue has no"
1064 uint32_t bufBytes = buf.buffer()->size();
1068 "Bad bookkeeping while updating frames pending. Timed buffer is"
1084 const sp<IMemory>& buffer, int64_t pts) {
1094 uint32_t bufFrames = buffer->size() / mFrameSize;
1096 mTimedBufferQueue.add(TimedBuffer(buffer, pts));
1125 AudioBufferProvider::Buffer* buffer, int64_t pts)
1128 buffer->raw = NULL;
1129 buffer->frameCount = 0;
1143 buffer->raw = NULL;
1144 buffer->frameCount = 0;
1150 // calculate the PTS of the head of the timed buffer queue expressed in
1160 timedYieldSilence_l(buffer->frameCount, buffer);
1168 // then just drop this buffer
1170 buffer->raw = NULL;
1171 buffer->frameCount = 0;
1179 buffer->raw = NULL;
1180 buffer->frameCount = 0;
1188 // adjust the head buffer's PTS to reflect the portion of the head buffer
1193 // Calculate the delta in samples between the head of the input buffer
1194 // queue and the start of the next output buffer that will be written.
1200 ALOGV("*** head buffer is too far from PTS: dropped buffer");
1207 ALOGV("*** too late during sample rate transform: dropped buffer");
1225 // if this is the first buffer of audio that we're emitting from this track
1233 timedYieldSamples_l(buffer);
1236 head.position(), buffer->frameCount);
1249 timedYieldSilence_l(framesUntilNextInput, buffer);
1250 ALOGV("*** silence: frameCount=%u", buffer->frameCount);
1258 if (onTimeSamplePosition > head.buffer()->size()) {
1261 ALOGV("*** too late: dropped buffer");
1262 trimTimedBufferQueueHead_l("getNextBuffer, dropped late buffer");
1269 timedYieldSamples_l(buffer);
1271 ALOGV("*** late: head.pos=%d frameCount=%u", head.position(), buffer->frameCount);
1278 // Yield samples from the timed buffer queue head up to the given output
1279 // buffer's capacity.
1283 AudioBufferProvider::Buffer* buffer) {
1287 buffer->raw = (static_cast<uint8_t*>(head.buffer()->pointer()) +
1290 uint32_t framesLeftInHead = ((head.buffer()->size() - head.position()) /
1292 size_t framesRequested = buffer->frameCount;
1293 buffer->frameCount = min(framesLeftInHead, framesRequested);
1299 // Yield samples of silence up to the given output buffer's capacity
1303 uint32_t numFrames, AudioBufferProvider::Buffer* buffer) {
1305 // lazily allocate a buffer filled with silence
1313 buffer->raw = mTimedSilenceBuffer;
1314 size_t framesRequested = buffer->frameCount;
1315 buffer->frameCount = min(numFrames, framesRequested);
1322 AudioBufferProvider::Buffer* buffer) {
1326 // If the bufferbuffer at the head
1327 // of the queue, be sure to update the amt of the buffer which has been
1328 // consumed. If the buffer being returned is not part of the head of the
1329 // queue, its either because the buffer is part of the silence buffer, or
1332 if (buffer->raw == mTimedSilenceBuffer) {
1334 "Queue head in flight during release of silence buffer!");
1339 "TimedTrack::releaseBuffer of non-silence buffer, but no queue"
1345 void* start = head.buffer()->pointer();
1347 reinterpret_cast<uint8_t*>(head.buffer()->pointer())
1348 + head.buffer()->size());
1350 ALOG_ASSERT((buffer->raw >= start) && (buffer->raw < end),
1351 "released buffer not within the head of the timed buffer"
1352 " queue; qHead = [%p, %p], released buffer = %p",
1353 start, end, buffer->raw);
1356 (buffer->frameCount * mFrameSize));
1359 ALOG_ASSERT(mFramesPendingInQueue >= buffer->frameCount,
1362 buffer->frameCount, mFramesPendingInQueue);
1364 mFramesPendingInQueue -= buffer->frameCount;
1366 if ((static_cast<size_t>(head.position()) >= head.buffer()->size())
1372 LOG_FATAL("TimedTrack::releaseBuffer of non-silence buffer with no"
1373 " buffers in the timed buffer queue");
1377 buffer->raw = 0;
1378 buffer->frameCount = 0;
1390 const sp<IMemory>& buffer, int64_t pts)
1391 : mBuffer(buffer), mPTS(pts), mPosition(0) {}
1416 // the buffer has the same virtual address on both sides
1456 Buffer *pInBuffer;
1457 Buffer inBuffer;
1473 pInBuffer = new Buffer;
1529 ALOGV("OutputTrack::write() %p thread %p released overflow buffer %d", this,
1537 // If we could not write all frames, allocate a buffer and queue it for next time.
1542 pInBuffer = new Buffer;
1549 ALOGV("OutputTrack::write() %p thread %p adding overflow buffer %d", this,
1558 // Calling write() with a 0 length buffer, means that no more data will be written:
1559 // If no more buffers are pending, fill output track buffer to make sure it is started
1564 pInBuffer = new Buffer;
1579 AudioBufferProvider::Buffer* buffer, uint32_t waitTimeMs)
1582 uint32_t framesReq = buffer->frameCount;
1585 buffer->frameCount = 0;
1615 buffer->frameCount = framesReq;
1616 buffer->raw = mClientProxy->buffer(u);
1626 Buffer *pBuffer = mBufferQueue.itemAt(i);
1699 status_t AudioFlinger::RecordThread::RecordTrack::getNextBuffer(AudioBufferProvider::Buffer* buffer,
1704 uint32_t framesReq = buffer->frameCount;
1729 buffer->raw = getBuffer(s, framesReq);
1730 buffer->frameCount = framesReq;
1735 buffer->raw = NULL;
1736 buffer->frameCount = 0;
1762 // read from buffer
1796 void AudioFlinger::RecordThread::RecordTrack::dump(char* buffer, size_t size)
1798 buffer, size, " %05d %03u 0x%08x %05d %04u %01d %08x %08x %05d\n",