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;
|
||||
partitionId = 0;
|
||||
beginningOfPartition = false;
|
||||
frameWidth = 0;
|
||||
frameHeight = 0;
|
||||
}
|
||||
|
||||
bool nonReference; // Frame is discardable.
|
||||
@ -69,6 +71,8 @@ struct RTPVideoHeaderVP8
|
||||
int partitionId; // VP8 partition ID
|
||||
bool beginningOfPartition; // True if this packet is the first
|
||||
// in a VP8 partition. Otherwise false
|
||||
int frameWidth; // Exists for key frames.
|
||||
int frameHeight; // Exists for key frames.
|
||||
};
|
||||
union RTPVideoTypeHeader
|
||||
{
|
||||
|
@ -647,6 +647,10 @@ RTPReceiverVideo::ReceiveVp8Codec(WebRtcRTPHeader* rtpHeader,
|
||||
kNoTl0PicIdx;
|
||||
toHeader->temporalIdx = fromHeader->hasTID ? fromHeader->tID :
|
||||
kNoTemporalIdx;
|
||||
|
||||
toHeader->frameWidth = fromHeader->frameWidth;
|
||||
toHeader->frameHeight = fromHeader->frameHeight;
|
||||
|
||||
toHeader->partitionId = fromHeader->partitionID;
|
||||
toHeader->beginningOfPartition = fromHeader->beginningOfPartition;
|
||||
|
||||
|
@ -385,6 +385,8 @@ ModuleRTPUtility::RTPPayload::SetType(RtpVideoCodecTypes videoType)
|
||||
info.VP8.pictureID = -1;
|
||||
info.VP8.tl0PicIdx = -1;
|
||||
info.VP8.tID = -1;
|
||||
info.VP8.frameWidth = 0;
|
||||
info.VP8.frameHeight = 0;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -868,15 +870,38 @@ ModuleRTPUtility::RTPPayloadParser::ParseVP8(RTPPayload& parsedPacket) const
|
||||
{
|
||||
parsedPacket.frameType = kPFrame;
|
||||
}
|
||||
|
||||
if (0 != ParseVP8FrameSize(parsedPacket, dataPtr, dataLength))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
parsedPacket.info.VP8.data = dataPtr;
|
||||
parsedPacket.info.VP8.dataLength = dataLength;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
ModuleRTPUtility::RTPPayloadParser::ParseVP8Extension(
|
||||
int ModuleRTPUtility::RTPPayloadParser::ParseVP8FrameSize(
|
||||
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,
|
||||
const WebRtc_UWord8 *dataPtr,
|
||||
int dataLength) const
|
||||
|
@ -42,7 +42,7 @@ namespace ModuleRTPUtility
|
||||
struct VideoPayload
|
||||
{
|
||||
RtpVideoCodecTypes videoCodecType;
|
||||
WebRtc_UWord32 maxRate;
|
||||
WebRtc_UWord32 maxRate;
|
||||
};
|
||||
union PayloadUnion
|
||||
{
|
||||
@ -51,7 +51,7 @@ namespace ModuleRTPUtility
|
||||
};
|
||||
struct Payload
|
||||
{
|
||||
WebRtc_Word8 name[RTP_PAYLOAD_NAME_SIZE];
|
||||
WebRtc_Word8 name[RTP_PAYLOAD_NAME_SIZE];
|
||||
bool audio;
|
||||
PayloadUnion typeSpecific;
|
||||
};
|
||||
@ -148,8 +148,10 @@ namespace ModuleRTPUtility
|
||||
int pictureID;
|
||||
int tl0PicIdx;
|
||||
int tID;
|
||||
int frameWidth;
|
||||
int frameHeight;
|
||||
|
||||
const WebRtc_UWord8* data;
|
||||
const WebRtc_UWord8* data;
|
||||
WebRtc_UWord16 dataLength;
|
||||
};
|
||||
|
||||
@ -211,6 +213,10 @@ namespace ModuleRTPUtility
|
||||
int *dataLength,
|
||||
int *parsedBytes) const;
|
||||
|
||||
int ParseVP8FrameSize(RTPPayload& parsedPacket,
|
||||
const WebRtc_UWord8 *dataPtr,
|
||||
int dataLength) const;
|
||||
|
||||
// H.263
|
||||
bool H263PictureStartCode(const WebRtc_UWord8* data,
|
||||
const bool skipFirst2bytes = false) const;
|
||||
|
Loading…
Reference in New Issue
Block a user