Home | History | Annotate | Download | only in audioflinger

Lines Matching refs:buffer

71             void *buffer,
116 size_t bufferSize = (buffer == NULL ? roundup(frameCount) : frameCount) * mFrameSize;
117 if (buffer == NULL && alloc == ALLOC_CBLK) {
145 ALOGE("not enough memory for read-only buffer size=%zu", bufferSize);
147 roHeap->dump("buffer");
159 // However in this case the TrackBase does not reference the buffer directly.
160 // It should references the buffer via the pipe.
161 // Therefore, to detect incorrect usage of the buffer, we set mBuffer to NULL.
166 if (buffer == NULL) {
170 mBuffer = buffer;
180 mBuffer = buffer;
240 // flush the binder command buffer
247 void AudioFlinger::ThreadBase::TrackBase::releaseBuffer(AudioBufferProvider::Buffer* buffer)
251 (void) mTeeSink->write(buffer->raw, buffer->frameCount);
255 ServerProxy::Buffer buf;
256 buf.mFrameCount = buffer->frameCount;
257 buf.mRaw = buffer->raw;
258 buffer->frameCount = 0;
259 buffer->raw = NULL;
313 sp<IMemory>* buffer) {
319 return tt->allocateTimedBuffer(size, buffer);
322 status_t AudioFlinger::TrackHandle::queueTimedBuffer(const sp<IMemory>& buffer,
327 if (buffer == 0 || buffer->pointer() == NULL) {
328 ALOGE("queueTimedBuffer() buffer is 0 or has NULL pointer()");
334 return tt->queueTimedBuffer(buffer, pts);
381 void *buffer,
388 (sharedBuffer != 0) ? sharedBuffer->pointer() : buffer,
390 (type == TYPE_PATCH) ? ( buffer == NULL ? ALLOC_LOCAL : ALLOC_NONE) : ALLOC_CBLK,
505 void AudioFlinger::PlaybackThread::Track::dump(char* buffer, size_t size, bool active)
509 sprintf(buffer, " F %2d", mFastIndex);
511 sprintf(buffer, " %4d", mName - AudioMixer::TRACK0);
513 sprintf(buffer, " none");
568 snprintf(&buffer[8], size-8, " %6s %6u %4u %08X %08X %7u %6zu %1c %1d %5u %5.2g %5.2g "
596 AudioBufferProvider::Buffer* buffer, int64_t pts __unused)
598 ServerProxy::Buffer buf;
599 size_t desiredFrames = buffer->frameCount;
602 buffer->frameCount = buf.mFrameCount;
603 buffer->raw = buf.mRaw;
712 ServerProxy::Buffer buffer;
713 buffer.mFrameCount = 1;
714 (void) mAudioTrackServerProxy->obtainBuffer(&buffer, true /*ackFlush*/);
807 ALOGV("flush called in active state, resetting buffer time out retry count");
835 // because the hardware buffer could hold a large amount of audio
855 // written to buffer
997 void AudioFlinger::PlaybackThread::Track::setAuxBuffer(int EffectId, int32_t *buffer)
1000 mAuxBuffer = buffer;
1008 // first time (mPresentationCompleteFrames == 0) plus the buffer filling status at that time.
1198 size_t size, sp<IMemory>* buffer) {
1220 *buffer = newBuffer;
1251 // We have a next buffer. Just use its PTS as the PTS of the frame
1252 // following the last frame in this buffer. If the stream is sparse
1255 // in one extra buffer being left un-trimmed when it could have
1261 // We have no next buffer. Compute the PTS of the frame following
1262 // the last frame in this buffer by computing the duration of of
1264 // buffer.
1265 int64_t frameCount = mTimedBufferQueue[trimEnd].buffer()->size()
1284 // Is the buffer we want to use in the middle of a mix operation right
1307 "%s called (reason \"%s\"), but timed buffer queue has no"
1317 uint32_t bufBytes = buf.buffer()->size();
1321 "Bad bookkeeping while updating frames pending. Timed buffer is"
1337 const sp<IMemory>& buffer, int64_t pts) {
1347 uint32_t bufFrames = buffer->size() / mFrameSize;
1349 mTimedBufferQueue.add(TimedBuffer(buffer, pts));
1378 AudioBufferProvider::Buffer* buffer, int64_t pts)
1381 buffer->raw = NULL;
1382 buffer->frameCount = 0;
1396 buffer->raw = NULL;
1397 buffer->frameCount = 0;
1403 // calculate the PTS of the head of the timed buffer queue expressed in
1413 timedYieldSilence_l(buffer->frameCount, buffer);
1421 // then just drop this buffer
1423 buffer->raw = NULL;
1424 buffer->frameCount = 0;
1432 buffer->raw = NULL;
1433 buffer->frameCount = 0;
1443 // adjust the head buffer's PTS to reflect the portion of the head buffer
1448 // Calculate the delta in samples between the head of the input buffer
1449 // queue and the start of the next output buffer that will be written.
1455 ALOGV("*** head buffer is too far from PTS: dropped buffer");
1462 ALOGV("*** too late during sample rate transform: dropped buffer");
1480 // if this is the first buffer of audio that we're emitting from this track
1488 timedYieldSamples_l(buffer);
1491 head.position(), buffer->frameCount);
1504 timedYieldSilence_l(framesUntilNextInput, buffer);
1505 ALOGV("*** silence: frameCount=%u", buffer->frameCount);
1513 if (onTimeSamplePosition > head.buffer()->size()) {
1516 ALOGV("*** too late: dropped buffer");
1517 trimTimedBufferQueueHead_l("getNextBuffer, dropped late buffer");
1524 timedYieldSamples_l(buffer);
1526 ALOGV("*** late: head.pos=%d frameCount=%u", head.position(), buffer->frameCount);
1533 // Yield samples from the timed buffer queue head up to the given output
1534 // buffer's capacity.
1538 AudioBufferProvider::Buffer* buffer) {
1542 buffer->raw = (static_cast<uint8_t*>(head.buffer()->pointer()) +
1545 uint32_t framesLeftInHead = ((head.buffer()->size() - head.position()) /
1547 size_t framesRequested = buffer->frameCount;
1548 buffer->frameCount = min(framesLeftInHead, framesRequested);
1554 // Yield samples of silence up to the given output buffer's capacity
1558 uint32_t numFrames, AudioBufferProvider::Buffer* buffer) {
1560 // lazily allocate a buffer filled with silence
1568 buffer->raw = mTimedSilenceBuffer;
1569 size_t framesRequested = buffer->frameCount;
1570 buffer->frameCount = min(numFrames, framesRequested);
1577 AudioBufferProvider::Buffer* buffer) {
1581 // If the buffer which was just released is part of the buffer at the head
1582 // of the queue, be sure to update the amt of the buffer which has been
1583 // consumed. If the buffer being returned is not part of the head of the
1584 // queue, its either because the buffer is part of the silence buffer, or
1587 if (buffer->raw == mTimedSilenceBuffer) {
1589 "Queue head in flight during release of silence buffer!");
1594 "TimedTrack::releaseBuffer of non-silence buffer, but no queue"
1600 void* start = head.buffer()->pointer();
1602 reinterpret_cast<uint8_t*>(head.buffer()->pointer())
1603 + head.buffer()->size());
1605 ALOG_ASSERT((buffer->raw >= start) && (buffer->raw < end),
1606 "released buffer not within the head of the timed buffer"
1607 " queue; qHead = [%p, %p], released buffer = %p",
1608 start, end, buffer->raw);
1611 (buffer->frameCount * mFrameSize));
1614 ALOG_ASSERT(mFramesPendingInQueue >= buffer->frameCount,
1617 buffer->frameCount, mFramesPendingInQueue);
1619 mFramesPendingInQueue -= buffer->frameCount;
1621 if ((static_cast<size_t>(head.position()) >= head.buffer()->size())
1627 LOG_ALWAYS_FATAL("TimedTrack::releaseBuffer of non-silence buffer with no"
1628 " buffers in the timed buffer queue");
1632 buffer->raw = 0;
1633 buffer->frameCount = 0;
1645 const sp<IMemory>& buffer, int64_t pts)
1646 : mBuffer(buffer), mPTS(pts), mPosition(0) {}
1672 // the buffer has the same virtual address on both sides
1713 Buffer *pInBuffer;
1714 Buffer inBuffer;
1730 pInBuffer = new Buffer;
1776 Proxy::Buffer buf;
1790 ALOGV("OutputTrack::write() %p thread %p released overflow buffer %d", this,
1798 // If we could not write all frames, allocate a buffer and queue it for next time.
1803 pInBuffer = new Buffer;
1810 ALOGV("OutputTrack::write() %p thread %p adding overflow buffer %d", this,
1819 // Calling write() with a 0 length buffer, means that no more data will be written:
1820 // If no more buffers are pending, fill output track buffer to make sure it is started
1827 pInBuffer = new Buffer;
1842 AudioBufferProvider::Buffer* buffer, uint32_t waitTimeMs)
1844 ClientProxy::Buffer buf;
1845 buf.mFrameCount = buffer->frameCount;
1850 buffer->frameCount = buf.mFrameCount;
1851 buffer->raw = buf.mRaw;
1860 Buffer *pBuffer = mBufferQueue.itemAt(i);
1873 void *buffer,
1876 buffer, 0, 0, getuid(), flags, TYPE_PATCH),
1896 AudioBufferProvider::Buffer* buffer, int64_t pts)
1899 Proxy::Buffer buf;
1900 buf.mFrameCount = buffer->frameCount;
1903 buffer->frameCount = buf.mFrameCount;
1907 status = Track::getNextBuffer(buffer, pts);
1911 void AudioFlinger::PlaybackThread::PatchTrack::releaseBuffer(AudioBufferProvider::Buffer* buffer)
1914 Proxy::Buffer buf;
1915 buf.mFrameCount = buffer->frameCount;
1916 buf.mRaw = buffer->raw;
1918 TrackBase::releaseBuffer(buffer);
1921 status_t AudioFlinger::PlaybackThread::PatchTrack::obtainBuffer(Proxy::Buffer* buffer,
1924 return mProxy->obtainBuffer(buffer, timeOut);
1927 void AudioFlinger::PlaybackThread::PatchTrack::releaseBuffer(Proxy::Buffer* buffer)
1929 mProxy->releaseBuffer(buffer);
1984 void *buffer,
1990 channelMask, frameCount, buffer, sessionId, uid,
1994 ((buffer == NULL) ? ALLOC_LOCAL : ALLOC_NONE),
2035 status_t AudioFlinger::RecordThread::RecordTrack::getNextBuffer(AudioBufferProvider::Buffer* buffer,
2038 ServerProxy::Buffer buf;
2039 buf.mFrameCount = buffer->frameCount;
2041 buffer->frameCount = buf.mFrameCount;
2042 buffer->raw = buf.mRaw;
2109 void AudioFlinger::RecordThread::RecordTrack::dump(char* buffer, size_t size, bool active)
2111 snprintf(buffer, size, " %6s %6u %3u %08X %7u %1d %08X %6zu %5u\n",
2130 // TODO: use actual buffer filling status instead of 2 buffers when info is available
2153 void *buffer,
2156 buffer, 0, getuid(), flags, TYPE_PATCH),
2176 Buffer* buffer, int64_t pts)
2179 Proxy::Buffer buf;
2180 buf.mFrameCount = buffer->frameCount;
2184 buffer->frameCount = buf.mFrameCount;
2188 status = RecordTrack::getNextBuffer(buffer, pts);
2192 void AudioFlinger::RecordThread::PatchRecord::releaseBuffer(AudioBufferProvider::Buffer* buffer)
2195 Proxy::Buffer buf;
2196 buf.mFrameCount = buffer->frameCount;
2197 buf.mRaw = buffer->raw;
2199 TrackBase::releaseBuffer(buffer);
2202 status_t AudioFlinger::RecordThread::PatchRecord::obtainBuffer(Proxy::Buffer* buffer,
2205 return mProxy->obtainBuffer(buffer, timeOut);
2208 void AudioFlinger::RecordThread::PatchRecord::releaseBuffer(Proxy::Buffer* buffer)
2210 mProxy->releaseBuffer(buffer);