2,543
社区成员
发帖
与我相关
我的任务
分享
enqueue(&fBuf[fPacketStart + fOverflowDataOffset], fOverflowDataSize);[
是往fBuf 存数据吧?
void OutPacketBuffer::enqueue(unsigned char const* from, unsigned numBytes) {
if (numBytes > totalBytesAvailable()) {
#ifdef DEBUG
fprintf(stderr, "OutPacketBuffer::enqueue() warning: %d > %d\n", numBytes, totalBytesAvailable());
#endif
numBytes = totalBytesAvailable();
}
if (curPtr() != from) memmove(curPtr(), from, numBytes);
increment(numBytes);
}
void FramedSource::getNextFrame(unsigned char* to, unsigned maxSize,//to就是doGetNextFrame();读取的视频数据
afterGettingFunc* afterGettingFunc,
void* afterGettingClientData,
onCloseFunc* onCloseFunc,
void* onCloseClientData) {
// Make sure we're not already being read:
if (fIsCurrentlyAwaitingData) {
envir() << "FramedSource[" << this << "]::getNextFrame(): attempting to read more than once at the same time!\n";
envir().internalError();
}
fTo = to;
fMaxSize = maxSize;
fNumTruncatedBytes = 0; // by default; could be changed by doGetNextFrame()
fDurationInMicroseconds = 0; // by default; could be changed by doGetNextFrame()
fAfterGettingFunc = afterGettingFunc;
fAfterGettingClientData = afterGettingClientData;
fOnCloseFunc = onCloseFunc;
fOnCloseClientData = onCloseClientData;
fIsCurrentlyAwaitingData = True;
doGetNextFrame();//读数据就在这里面
}
FramedSource::getNextFrame ()
--》****::doGetNextFrame()
--》envir().taskScheduler().turnOnBackgroundReadHandling(fileno(fFid),
(TaskScheduler::BackgroundHandlerProc*)&fileReadableHandler, this);//原来添加到任务队列了
--》source->doReadFromFile();
--》fFrameSize = fread(fTo, 1, fMaxSize, fFid);//打开文件的句柄fFid
最终找到了doGetNextFrame, virtual void doGetNextFrame() = 0;是Framesource的虚函数被他的派生类继承了