问题描述
亲爱的,
我对推送源过滤器有疑问。如果源过滤器正在接收来自
I have a question about push source filter. If the source filter is recieveing live stream from
网络的实时流,那么每次收到数据包时都会调用FillBuffer方法吗?
network, is the FillBuffer method called every time when it recieves a packet?
我想编写一个实时源过滤器,但只设法改变球示例中的代码。
I want to write a live souce filter, but only managed to change the code from the ball example.
所以它是推送源过滤器,但不是实时源过滤器,是不是?如何撰写实时来源
So it is a push source filter, but not a live source filter, is it right? How do I write a live source
过滤器?
另一个问题是:我实际上是用过这个推送源过滤器从网络接收数据,
Another question is: I actually used this push source filter to recieve data from network,
并使用FillBuffer将数据转换为下游。我没有做任何时间戳,
and used FillBuffer to transform data to the downstream. I don't do any time stamp, is
这个对吗?我的程序运行得很好,有时很乱。它是关于FillBuffer
this right? My program runs sometimes well, sometimes messy. Is it about the FillBuffer
方法每次收到数据包时都不会被触发吗?
method not triggered every time it recieving a packet?
谢谢提前,
Alex
推荐答案
HRESULT JrtpStream::FillBuffer(IMediaSample *pms){ session.BeginDataAccess(); //check incoming packets if (session.GotoFirstSourceWithData()) { RTPPacket *pack; pack = session.GetNextPacket(); unsigned char* payloaddat = pack->GetPayloadData(); size_t payloadlen = pack->GetPayloadLength(); BYTE *pdat; pms->GetPointer(&pdat); memcpy(pdat, (BYTE *)payloaddat, payloadlen); //pms->SetActualDataLength(payloadlen); session.DeletePacket(pack); } session.EndDataAccess(); //REFERENCE_TIME rtStart = m_iFrameNumber * m_rtFrameLength; // REFERENCE_TIME rtStop = rtStart + m_rtFrameLength; // pms->SetTime(&rtStart, &rtStop); // m_iFrameNumber++; // // Set TRUE on every sample for uncompressed frames // pms->SetSyncPoint(true); return S_OK;}
我附上了我的代码。 我很困惑,因为在此功能中,FillBuffer将在特定于过滤器的时间内被调用
I attached my code. I am very confused because in this function FillBuffer will be called
,因此只有那些准时到达的数据才会被接收和处理
in a filter-specific time, so only those data arriving on time will be recieved and processed
(如果我理解正确的话)。我认为这就是图像混乱的原因。可以
(if I understand this correctly). I think this is the reason that the images are messy. Can
有人指出了一种正确的做法吗?
anyone point out a way that do it rightly?
提前感谢
thanks in advance
这篇关于实时源过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!