本文整理汇总了C++中OsclMemAllocator::allocate方法的典型用法代码示例。如果您正苦于以下问题:C++ OsclMemAllocator::allocate方法的具体用法?C++ OsclMemAllocator::allocate怎么用?C++ OsclMemAllocator::allocate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OsclMemAllocator
的用法示例。
在下文中一共展示了OsclMemAllocator::allocate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AndroidAudioOutput
/*
/ Packet Video Audio MIO component
/
/ This implementation routes audio to AudioFlinger. Audio buffers are
/ enqueued in a message queue to a separate audio output thread. Once
/ the buffers have been successfully written, they are returned through
/ another message queue to the MIO and from there back to the engine.
/ This separation is necessary because most of the PV API is not
/ thread-safe.
*/
OSCL_EXPORT_REF AndroidAudioOutput::AndroidAudioOutput() :
AndroidAudioMIO("AndroidAudioOutput"),
iAudioThreadCreated(false),
iExitAudioThread(false),
iActiveTiming(NULL)
{
iClockTimeOfWriting_ns = 0;
iInputFrameSizeInBytes = 0;
// semaphore used to communicate between this mio and the audio output thread
iAudioThreadSem = new OsclSemaphore();
iAudioThreadSem->Create(0);
iAudioThreadTermSem = new OsclSemaphore();
iAudioThreadTermSem->Create(0);
// locks to access the queues by this mio and by the audio output thread
iOSSRequestQueueLock.Create();
iOSSRequestQueue.reserve(iWriteResponseQueue.capacity());
// create active timing object
OsclMemAllocator alloc;
OsclAny*ptr=alloc.allocate(sizeof(AndroidAudioMIOActiveTimingSupport));
if (ptr) {
iActiveTiming=new(ptr)AndroidAudioMIOActiveTimingSupport(kMaxClockDriftInMsecs, kMaxClockCorrection);
iActiveTiming->setThreadSemaphore(iAudioThreadSem);
}
}
示例2: new
bool
PVMFSocketPort::pvmiGetPortInPlaceDataProcessingInfoSync(const char* aFormatValType,
PvmiKvp*& aKvp)
{
/*
* Create PvmiKvp for capability settings
*/
aKvp = NULL;
OsclMemAllocator alloc;
uint32 strLen = oscl_strlen(aFormatValType) + 1;
uint8* ptr = (uint8*)alloc.allocate(sizeof(PvmiKvp) + strLen);
if (!ptr)
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_MLDBG, iLogger, PVLOGMSG_ERR, (0, "PVMFSocketPort::pvmiGetPortInPlaceDataProcessingInfoSync: Error - No memory. Cannot allocate PvmiKvp"));
return false;
}
aKvp = new(ptr) PvmiKvp;
ptr += sizeof(PvmiKvp);
aKvp->key = (PvmiKeyType)ptr;
oscl_strncpy(aKvp->key, aFormatValType, strLen);
aKvp->length = aKvp->capacity = strLen;
#if SNODE_ENABLE_UDP_MULTI_PACKET
if (iTag == PVMF_SOCKET_NODE_PORT_TYPE_SOURCE)
aKvp->value.bool_value = false;//for the multiple UDP recv feature
else
#endif
aKvp->value.bool_value = true;
return true;
}
示例3: AndroidAudioStream
/*
/ Packet Video Audio MIO component
/
/ This implementation routes audio to a stream interface
*/
OSCL_EXPORT_REF AndroidAudioStream::AndroidAudioStream() :
AndroidAudioMIO("AndroidAudioStream"),
iActiveTiming(NULL), mClockUpdated(false)
{
// create active timing object
LOGV("constructor");
OsclMemAllocator alloc;
OsclAny*ptr=alloc.allocate(sizeof(AndroidAudioMIOActiveTimingSupport));
if (ptr) {
iActiveTiming = new(ptr)AndroidAudioMIOActiveTimingSupport(0, 0);
}
}
示例4: setURI
////// INetURI implementation
////////////////////////////////////////////////////////////////////////////////////
bool INetURI::setURI(OSCL_wString &aUri, const bool aRedirectURI)
{
if (aUri.get_size() == 0) return false;
OsclMemAllocator alloc;
char *buf = (char*)alloc.allocate(aUri.get_size() + 1);
if (!buf) return false;
uint32 size = oscl_UnicodeToUTF8(aUri.get_cstr(), aUri.get_size(), buf, aUri.get_size() + 1);
if (size == 0)
{
alloc.deallocate(buf);
return false;
}
iURI = OSCL_HeapString<OsclMemAllocator> (buf, size);
alloc.deallocate(buf);
// clear iHost
iHostName.set(NULL, 0);
iRedirectURI = aRedirectURI;
return true;
}
开发者ID:Katarzynasrom,项目名称:patch-hosting-for-android-x86-support,代码行数:22,代码来源:pvmf_protocol_engine_common.cpp
示例5: sizeof
///////////////////////////////////Create a function to decode the StreamMuxConfig
// note this function should ideally also get a reference to an object that holds the values
// for the streammuxconfig... these are alse needed in the mediaInfo class (to pass to
// the parser constructor) and can be gotten here. for now just get the audiospecificconfig
OSCL_EXPORT_REF uint8 * PV_LATM_Parser::ParseStreamMuxConfig(uint8* decoderSpecificConfig, int32 * size)
{
uint32 SMC_SUCCESS = 0;
uint32 SMC_INVALID_MUX_VERSION = 1;
uint32 SMC_INVALID_NUM_PROGRAM = 2;
uint32 SMC_INVALID_NUM_LAYER = 4;
uint32 SMC_INVALID_OBJECT_TYPE = 8;
uint32 SMC_USED_RESERVED_SAMPLING_FREQ = 16;
uint32 samplingFreqTable[] =
{
96000, 88200, 64000, 48000, 44100,
32000, 24000, 22050, 16000, 12000,
11025, 8000, 7350
};
if (*size == 0)
{
// means there is nothing to parse
return NULL;
}
// size should be the length of the decoderSpecificConfig.. the AudioSpecificConfing cant
// be larger than that, so just allocate that number of bytes
// we wont know until we've parsed it how big it is.
OsclMemAllocator alloc;
uint8* ASCPtr = (uint8*)(alloc.allocate(sizeof(uint8) * (*size)));
if (ASCPtr == NULL)
{
// memory allocation problem?
*size = 0;
return NULL;
}
oscl_memset(ASCPtr, 0, *size);
OsclExclusivePtrA<uint8, OsclMemAllocator> ascAutoPtr;
ascAutoPtr.set(ASCPtr);
//streamMuxConfig * sMC;
sMC = (streamMuxConfig *) oscl_calloc(1, sizeof(streamMuxConfig));
if (sMC == NULL)
{ // unlikely: calloc failure
return NULL;
}
sMC->parseResult = SMC_SUCCESS; // set default result
uint32 bitPos = 0;
uint32 ASCPos = 0;
int32 temp;
int32 numProgram = 0;
int32 prog, lay;
int32 numLayer;
int32 count;
int32 dependsOnCoreCoder;
// audio mux version
sMC->audioMuxVersion = BufferReadBits(decoderSpecificConfig, &bitPos, 1);
if (sMC->audioMuxVersion == 0)
{
// should not be anything other than 0!!
// all streams same time framing
sMC->allStreamsSameTimeFraming = BufferReadBits(decoderSpecificConfig, &bitPos, 1);
/*
* numSubFrames -- how many payloadmux() are multiplexed
*/
sMC->numSubFrames = BufferReadBits(decoderSpecificConfig, &bitPos, 6);
/*
* numPrograms -- how many programs are multiplexed
*/
numProgram = BufferReadBits(decoderSpecificConfig, &bitPos, 4);
if (numProgram != 0)
{
sMC->parseResult |= SMC_INVALID_NUM_PROGRAM;
//numProgram = 0;
// really should exit
*size = 0;
return NULL;
}
// loop through programs -- happens only once now
for (prog = 0; prog <= numProgram; prog++)
{
// can only be one numProgram (RFC3016)
numLayer = BufferReadBits(decoderSpecificConfig, &bitPos, 3);
/*
* Number of scalable layers, only one is indicated in rfc3016
*/
if (numLayer != 0)
//.........这里部分代码省略.........