Added parsing of width and height from VP8 header
Review URL: http://webrtc-codereview.appspot.com/241012 git-svn-id: http://webrtc.googlecode.com/svn/trunk@875 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
679cb07980
commit
075e91fa27
@ -58,6 +58,8 @@ struct RTPVideoHeaderVP8
|
|||||||
temporalIdx = kNoTemporalIdx;
|
temporalIdx = kNoTemporalIdx;
|
||||||
partitionId = 0;
|
partitionId = 0;
|
||||||
beginningOfPartition = false;
|
beginningOfPartition = false;
|
||||||
|
frameWidth = 0;
|
||||||
|
frameHeight = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nonReference; // Frame is discardable.
|
bool nonReference; // Frame is discardable.
|
||||||
@ -69,6 +71,8 @@ struct RTPVideoHeaderVP8
|
|||||||
int partitionId; // VP8 partition ID
|
int partitionId; // VP8 partition ID
|
||||||
bool beginningOfPartition; // True if this packet is the first
|
bool beginningOfPartition; // True if this packet is the first
|
||||||
// in a VP8 partition. Otherwise false
|
// in a VP8 partition. Otherwise false
|
||||||
|
int frameWidth; // Exists for key frames.
|
||||||
|
int frameHeight; // Exists for key frames.
|
||||||
};
|
};
|
||||||
union RTPVideoTypeHeader
|
union RTPVideoTypeHeader
|
||||||
{
|
{
|
||||||
|
@ -647,6 +647,10 @@ RTPReceiverVideo::ReceiveVp8Codec(WebRtcRTPHeader* rtpHeader,
|
|||||||
kNoTl0PicIdx;
|
kNoTl0PicIdx;
|
||||||
toHeader->temporalIdx = fromHeader->hasTID ? fromHeader->tID :
|
toHeader->temporalIdx = fromHeader->hasTID ? fromHeader->tID :
|
||||||
kNoTemporalIdx;
|
kNoTemporalIdx;
|
||||||
|
|
||||||
|
toHeader->frameWidth = fromHeader->frameWidth;
|
||||||
|
toHeader->frameHeight = fromHeader->frameHeight;
|
||||||
|
|
||||||
toHeader->partitionId = fromHeader->partitionID;
|
toHeader->partitionId = fromHeader->partitionID;
|
||||||
toHeader->beginningOfPartition = fromHeader->beginningOfPartition;
|
toHeader->beginningOfPartition = fromHeader->beginningOfPartition;
|
||||||
|
|
||||||
|
@ -385,6 +385,8 @@ ModuleRTPUtility::RTPPayload::SetType(RtpVideoCodecTypes videoType)
|
|||||||
info.VP8.pictureID = -1;
|
info.VP8.pictureID = -1;
|
||||||
info.VP8.tl0PicIdx = -1;
|
info.VP8.tl0PicIdx = -1;
|
||||||
info.VP8.tID = -1;
|
info.VP8.tID = -1;
|
||||||
|
info.VP8.frameWidth = 0;
|
||||||
|
info.VP8.frameHeight = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -868,15 +870,38 @@ ModuleRTPUtility::RTPPayloadParser::ParseVP8(RTPPayload& parsedPacket) const
|
|||||||
{
|
{
|
||||||
parsedPacket.frameType = kPFrame;
|
parsedPacket.frameType = kPFrame;
|
||||||
}
|
}
|
||||||
|
if (0 != ParseVP8FrameSize(parsedPacket, dataPtr, dataLength))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
parsedPacket.info.VP8.data = dataPtr;
|
parsedPacket.info.VP8.data = dataPtr;
|
||||||
parsedPacket.info.VP8.dataLength = dataLength;
|
parsedPacket.info.VP8.dataLength = dataLength;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int ModuleRTPUtility::RTPPayloadParser::ParseVP8FrameSize(
|
||||||
ModuleRTPUtility::RTPPayloadParser::ParseVP8Extension(
|
RTPPayload &parsedPacket,
|
||||||
|
const WebRtc_UWord8 *dataPtr,
|
||||||
|
int dataLength) const
|
||||||
|
{
|
||||||
|
if (parsedPacket.frameType != kIFrame)
|
||||||
|
{
|
||||||
|
// Included in payload header for I-frames.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (dataLength < 10)
|
||||||
|
{
|
||||||
|
// For an I-frame we should always have the uncompressed VP8 header
|
||||||
|
// in the beginning of the partition.
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
RTPPayloadVP8 *vp8 = &parsedPacket.info.VP8;
|
||||||
|
vp8->frameWidth = ((dataPtr[7] << 8) + dataPtr[6]) & 0x3FFF;
|
||||||
|
vp8->frameHeight = ((dataPtr[9] << 8) + dataPtr[8]) & 0x3FFF;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ModuleRTPUtility::RTPPayloadParser::ParseVP8Extension(
|
||||||
RTPPayloadVP8 *vp8,
|
RTPPayloadVP8 *vp8,
|
||||||
const WebRtc_UWord8 *dataPtr,
|
const WebRtc_UWord8 *dataPtr,
|
||||||
int dataLength) const
|
int dataLength) const
|
||||||
|
@ -42,7 +42,7 @@ namespace ModuleRTPUtility
|
|||||||
struct VideoPayload
|
struct VideoPayload
|
||||||
{
|
{
|
||||||
RtpVideoCodecTypes videoCodecType;
|
RtpVideoCodecTypes videoCodecType;
|
||||||
WebRtc_UWord32 maxRate;
|
WebRtc_UWord32 maxRate;
|
||||||
};
|
};
|
||||||
union PayloadUnion
|
union PayloadUnion
|
||||||
{
|
{
|
||||||
@ -51,7 +51,7 @@ namespace ModuleRTPUtility
|
|||||||
};
|
};
|
||||||
struct Payload
|
struct Payload
|
||||||
{
|
{
|
||||||
WebRtc_Word8 name[RTP_PAYLOAD_NAME_SIZE];
|
WebRtc_Word8 name[RTP_PAYLOAD_NAME_SIZE];
|
||||||
bool audio;
|
bool audio;
|
||||||
PayloadUnion typeSpecific;
|
PayloadUnion typeSpecific;
|
||||||
};
|
};
|
||||||
@ -148,8 +148,10 @@ namespace ModuleRTPUtility
|
|||||||
int pictureID;
|
int pictureID;
|
||||||
int tl0PicIdx;
|
int tl0PicIdx;
|
||||||
int tID;
|
int tID;
|
||||||
|
int frameWidth;
|
||||||
|
int frameHeight;
|
||||||
|
|
||||||
const WebRtc_UWord8* data;
|
const WebRtc_UWord8* data;
|
||||||
WebRtc_UWord16 dataLength;
|
WebRtc_UWord16 dataLength;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -211,6 +213,10 @@ namespace ModuleRTPUtility
|
|||||||
int *dataLength,
|
int *dataLength,
|
||||||
int *parsedBytes) const;
|
int *parsedBytes) const;
|
||||||
|
|
||||||
|
int ParseVP8FrameSize(RTPPayload& parsedPacket,
|
||||||
|
const WebRtc_UWord8 *dataPtr,
|
||||||
|
int dataLength) const;
|
||||||
|
|
||||||
// H.263
|
// H.263
|
||||||
bool H263PictureStartCode(const WebRtc_UWord8* data,
|
bool H263PictureStartCode(const WebRtc_UWord8* data,
|
||||||
const bool skipFirst2bytes = false) const;
|
const bool skipFirst2bytes = false) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user