mirror of
https://github.com/mpromonet/v4l2rtspserver
synced 2024-11-17 21:25:40 +00:00
accept short start code
This commit is contained in:
parent
adf18b550f
commit
f5ae14f3e4
@ -20,6 +20,7 @@
|
||||
// H264 V4L2 FramedSource
|
||||
// ---------------------------------
|
||||
const char H264marker[] = {0,0,0,1};
|
||||
const char H264shortmarker[] = {0,0,1};
|
||||
class H264_V4L2DeviceSource : public V4L2DeviceSource
|
||||
{
|
||||
public:
|
||||
|
@ -95,14 +95,24 @@ unsigned char* H264_V4L2DeviceSource::extractFrame(unsigned char* frame, size_t
|
||||
{
|
||||
unsigned char * outFrame = NULL;
|
||||
outsize = 0;
|
||||
unsigned int markerlength = 0;
|
||||
if ( (size>= sizeof(H264marker)) && (memcmp(frame,H264marker,sizeof(H264marker)) == 0) )
|
||||
{
|
||||
size -= sizeof(H264marker);
|
||||
outFrame = &frame[sizeof(H264marker)];
|
||||
markerlength = sizeof(H264marker);
|
||||
}
|
||||
else if (memcmp(frame,H264shortmarker,sizeof(H264shortmarker)) == 0)
|
||||
{
|
||||
markerlength = sizeof(H264shortmarker);
|
||||
}
|
||||
|
||||
if (markerlength != 0)
|
||||
{
|
||||
size -= markerlength;
|
||||
outFrame = &frame[markerlength];
|
||||
outsize = size;
|
||||
for (int i=0; i+sizeof(H264marker) < size; ++i)
|
||||
{
|
||||
if (memcmp(&outFrame[i],H264marker,sizeof(H264marker)) == 0)
|
||||
if ( (memcmp(&outFrame[i],H264marker,sizeof(H264marker)) == 0) || (memcmp(&outFrame[i],H264shortmarker,sizeof(H264shortmarker)) == 0) )
|
||||
{
|
||||
outsize = i;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user