-
Notifications
You must be signed in to change notification settings - Fork 565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
oboe: add blocking read/write #55
Changes from 2 commits
373e646
5fa5b88
362abd9
34217a7
a5d6637
f9fc01d
bc0643f
ee53861
477e01c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
#include <stdint.h> | ||
#include <time.h> | ||
#include <memory.h> | ||
#include <assert.h> | ||
|
||
#include "common/OboeDebug.h" | ||
#include "fifo/FifoControllerBase.h" | ||
|
@@ -36,12 +37,15 @@ FifoBuffer::FifoBuffer(uint32_t bytesPerFrame, uint32_t capacityInFrames) | |
, mFramesUnderrunCount(0) | ||
, mUnderrunCount(0) | ||
{ | ||
assert(bytesPerFrame > 0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a more elegant way we could handle these two assertions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe. I added them because this is a constructor and the FIFO cannot work if the values are incorrect. If they are zero then the FIFO seems to work but doesn't. This took a while to debug. I generally don't like asserts but they seem justified here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes agreed, just checking they weren't left in for debugging purposes. |
||
assert(capacityInFrames > 0); | ||
mFifo = new FifoController(capacityInFrames, capacityInFrames); | ||
// allocate buffer | ||
int32_t bytesPerBuffer = bytesPerFrame * capacityInFrames; | ||
mStorage = new uint8_t[bytesPerBuffer]; | ||
mStorageOwned = true; | ||
LOGD("FifoProcessor: numFrames = %d, bytesPerFrame = %d", capacityInFrames, bytesPerFrame); | ||
LOGD("FifoProcessor: capacityInFrames = %d, bytesPerFrame = %d", | ||
capacityInFrames, bytesPerFrame); | ||
} | ||
|
||
FifoBuffer::FifoBuffer( uint32_t bytesPerFrame, | ||
|
@@ -64,7 +68,8 @@ FifoBuffer::FifoBuffer( uint32_t bytesPerFrame, | |
writeIndexAddress); | ||
mStorage = dataStorageAddress; | ||
mStorageOwned = false; | ||
LOGD("FifoProcessor: capacityInFrames = %d, bytesPerFrame = %d", capacityInFrames, bytesPerFrame); | ||
LOGD("FifoProcessor: capacityInFrames = %d, bytesPerFrame = %d", | ||
capacityInFrames, bytesPerFrame); | ||
} | ||
|
||
FifoBuffer::~FifoBuffer() { | ||
|
@@ -173,6 +178,7 @@ int32_t FifoBuffer::readNow(void *buffer, int32_t numFrames) { | |
return framesRead; | ||
} | ||
|
||
// FIXME remove | ||
int64_t FifoBuffer::getNextReadTime(int frameRate) { | ||
if (mReadAtNanoseconds == 0) { | ||
return 0; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to "{" previous line.