Route CodecSpecificInfo from encoder to packetizer
Making a long chain of interface changes to route a CodecSpecificInfo struct from the video encoder function to the RTPSenderVideo. This will be used to convey information needed by the RTP packetizer when building the RTP headers. Review URL: http://webrtc-codereview.appspot.com/56001 git-svn-id: http://webrtc.googlecode.com/svn/trunk@140 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -541,12 +541,14 @@ public:
|
|||||||
*
|
*
|
||||||
* return -1 on failure else 0
|
* return -1 on failure else 0
|
||||||
*/
|
*/
|
||||||
virtual WebRtc_Word32 SendOutgoingData(const FrameType frameType,
|
virtual WebRtc_Word32
|
||||||
|
SendOutgoingData(const FrameType frameType,
|
||||||
const WebRtc_Word8 payloadType,
|
const WebRtc_Word8 payloadType,
|
||||||
const WebRtc_UWord32 timeStamp,
|
const WebRtc_UWord32 timeStamp,
|
||||||
const WebRtc_UWord8* payloadData,
|
const WebRtc_UWord8* payloadData,
|
||||||
const WebRtc_UWord32 payloadSize,
|
const WebRtc_UWord32 payloadSize,
|
||||||
const RTPFragmentationHeader* fragmentation = NULL) = 0;
|
const RTPFragmentationHeader* fragmentation = NULL,
|
||||||
|
const RTPVideoTypeHeader* rtpTypeHdr = NULL) = 0;
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -1076,7 +1076,8 @@ ModuleRtpRtcpImpl::SendOutgoingData(const FrameType frameType,
|
|||||||
const WebRtc_UWord32 timeStamp,
|
const WebRtc_UWord32 timeStamp,
|
||||||
const WebRtc_UWord8* payloadData,
|
const WebRtc_UWord8* payloadData,
|
||||||
const WebRtc_UWord32 payloadSize,
|
const WebRtc_UWord32 payloadSize,
|
||||||
const RTPFragmentationHeader* fragmentation)
|
const RTPFragmentationHeader* fragmentation,
|
||||||
|
const RTPVideoTypeHeader* rtpTypeHdr)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, _id,
|
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, _id,
|
||||||
"SendOutgoingData(frameType:%d payloadType:%d timeStamp:%u payloadSize:%u)",
|
"SendOutgoingData(frameType:%d payloadType:%d timeStamp:%u payloadSize:%u)",
|
||||||
@ -1099,7 +1100,9 @@ ModuleRtpRtcpImpl::SendOutgoingData(const FrameType frameType,
|
|||||||
timeStamp,
|
timeStamp,
|
||||||
payloadData,
|
payloadData,
|
||||||
payloadSize,
|
payloadSize,
|
||||||
fragmentation);
|
fragmentation,
|
||||||
|
NULL,
|
||||||
|
rtpTypeHdr);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
CriticalSectionScoped lock(_criticalSectionModulePtrs);
|
CriticalSectionScoped lock(_criticalSectionModulePtrs);
|
||||||
@ -1115,7 +1118,9 @@ ModuleRtpRtcpImpl::SendOutgoingData(const FrameType frameType,
|
|||||||
timeStamp,
|
timeStamp,
|
||||||
payloadData,
|
payloadData,
|
||||||
payloadSize,
|
payloadSize,
|
||||||
fragmentation);
|
fragmentation,
|
||||||
|
NULL,
|
||||||
|
rtpTypeHdr);
|
||||||
|
|
||||||
item = _childModules.Next(item);
|
item = _childModules.Next(item);
|
||||||
}
|
}
|
||||||
@ -1130,7 +1135,8 @@ ModuleRtpRtcpImpl::SendOutgoingData(const FrameType frameType,
|
|||||||
payloadData,
|
payloadData,
|
||||||
payloadSize,
|
payloadSize,
|
||||||
fragmentation,
|
fragmentation,
|
||||||
codecInfo);
|
codecInfo,
|
||||||
|
rtpTypeHdr);
|
||||||
|
|
||||||
item = _childModules.Next(item);
|
item = _childModules.Next(item);
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ class MatlabPlot;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
class ModuleRtpRtcpImpl : public ModuleRtpRtcpPrivate, private TMMBRHelp
|
class ModuleRtpRtcpImpl : public ModuleRtpRtcpPrivate, private TMMBRHelp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -224,12 +225,14 @@ public:
|
|||||||
virtual WebRtc_Word32 RegisterSendTransport(Transport* outgoingTransport);
|
virtual WebRtc_Word32 RegisterSendTransport(Transport* outgoingTransport);
|
||||||
|
|
||||||
// Used by the codec module to deliver a video or audio frame for packetization
|
// Used by the codec module to deliver a video or audio frame for packetization
|
||||||
virtual WebRtc_Word32 SendOutgoingData(const FrameType frameType,
|
virtual WebRtc_Word32
|
||||||
|
SendOutgoingData(const FrameType frameType,
|
||||||
const WebRtc_Word8 payloadType,
|
const WebRtc_Word8 payloadType,
|
||||||
const WebRtc_UWord32 timeStamp,
|
const WebRtc_UWord32 timeStamp,
|
||||||
const WebRtc_UWord8* payloadData,
|
const WebRtc_UWord8* payloadData,
|
||||||
const WebRtc_UWord32 payloadSize,
|
const WebRtc_UWord32 payloadSize,
|
||||||
const RTPFragmentationHeader* fragmentation = NULL);
|
const RTPFragmentationHeader* fragmentation = NULL,
|
||||||
|
const RTPVideoTypeHeader* rtpTypeHdr = NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* RTCP
|
* RTCP
|
||||||
|
@ -644,7 +644,8 @@ RTPSender::SendOutgoingData(const FrameType frameType,
|
|||||||
const WebRtc_UWord8* payloadData,
|
const WebRtc_UWord8* payloadData,
|
||||||
const WebRtc_UWord32 payloadSize,
|
const WebRtc_UWord32 payloadSize,
|
||||||
const RTPFragmentationHeader* fragmentation,
|
const RTPFragmentationHeader* fragmentation,
|
||||||
VideoCodecInformation* codecInfo)
|
VideoCodecInformation* codecInfo,
|
||||||
|
const RTPVideoTypeHeader* rtpTypeHdr)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
// Drop this packet if we're not sending media packets
|
// Drop this packet if we're not sending media packets
|
||||||
@ -686,7 +687,8 @@ RTPSender::SendOutgoingData(const FrameType frameType,
|
|||||||
payloadData,
|
payloadData,
|
||||||
payloadSize,
|
payloadSize,
|
||||||
fragmentation,
|
fragmentation,
|
||||||
codecInfo);
|
codecInfo,
|
||||||
|
rtpTypeHdr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,13 +124,15 @@ public:
|
|||||||
WebRtc_Word32 SetMaxPayloadLength(const WebRtc_UWord16 length,
|
WebRtc_Word32 SetMaxPayloadLength(const WebRtc_UWord16 length,
|
||||||
const WebRtc_UWord16 packetOverHead);
|
const WebRtc_UWord16 packetOverHead);
|
||||||
|
|
||||||
WebRtc_Word32 SendOutgoingData(const FrameType frameType,
|
WebRtc_Word32
|
||||||
|
SendOutgoingData(const FrameType frameType,
|
||||||
const WebRtc_Word8 payloadType,
|
const WebRtc_Word8 payloadType,
|
||||||
const WebRtc_UWord32 timeStamp,
|
const WebRtc_UWord32 timeStamp,
|
||||||
const WebRtc_UWord8* payloadData,
|
const WebRtc_UWord8* payloadData,
|
||||||
const WebRtc_UWord32 payloadSize,
|
const WebRtc_UWord32 payloadSize,
|
||||||
const RTPFragmentationHeader* fragmentation,
|
const RTPFragmentationHeader* fragmentation,
|
||||||
VideoCodecInformation* codecInfo = NULL);
|
VideoCodecInformation* codecInfo = NULL,
|
||||||
|
const RTPVideoTypeHeader* rtpTypeHdr = NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NACK
|
* NACK
|
||||||
|
@ -367,7 +367,8 @@ RTPSenderVideo::SendVideo(const RtpVideoCodecTypes videoType,
|
|||||||
const WebRtc_UWord8* payloadData,
|
const WebRtc_UWord8* payloadData,
|
||||||
const WebRtc_UWord32 payloadSize,
|
const WebRtc_UWord32 payloadSize,
|
||||||
const RTPFragmentationHeader* fragmentation,
|
const RTPFragmentationHeader* fragmentation,
|
||||||
VideoCodecInformation* codecInfo)
|
VideoCodecInformation* codecInfo,
|
||||||
|
const RTPVideoTypeHeader* rtpTypeHdr)
|
||||||
{
|
{
|
||||||
if( payloadSize == 0)
|
if( payloadSize == 0)
|
||||||
{
|
{
|
||||||
@ -406,8 +407,8 @@ RTPSenderVideo::SendVideo(const RtpVideoCodecTypes videoType,
|
|||||||
payloadData, payloadSize);
|
payloadData, payloadSize);
|
||||||
break;
|
break;
|
||||||
case kRtpVp8Video:
|
case kRtpVp8Video:
|
||||||
retVal = SendVP8(frameType, payloadType, captureTimeStamp, payloadData,
|
retVal = SendVP8(frameType, payloadType, captureTimeStamp,
|
||||||
payloadSize, fragmentation);
|
payloadData, payloadSize, fragmentation, rtpTypeHdr);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(false);
|
assert(false);
|
||||||
@ -1211,7 +1212,8 @@ RTPSenderVideo::SendVP8(const FrameType frameType,
|
|||||||
const WebRtc_UWord32 captureTimeStamp,
|
const WebRtc_UWord32 captureTimeStamp,
|
||||||
const WebRtc_UWord8* payloadData,
|
const WebRtc_UWord8* payloadData,
|
||||||
const WebRtc_UWord32 payloadSize,
|
const WebRtc_UWord32 payloadSize,
|
||||||
const RTPFragmentationHeader* fragmentation)
|
const RTPFragmentationHeader* fragmentation,
|
||||||
|
const RTPVideoTypeHeader* rtpTypeHdr)
|
||||||
{
|
{
|
||||||
const WebRtc_UWord16 rtpHeaderLength = _rtpSender.RTPHeaderLength();
|
const WebRtc_UWord16 rtpHeaderLength = _rtpSender.RTPHeaderLength();
|
||||||
WebRtc_UWord16 vp8HeaderLength = 1;
|
WebRtc_UWord16 vp8HeaderLength = 1;
|
||||||
|
@ -54,7 +54,8 @@ public:
|
|||||||
const WebRtc_UWord8* payloadData,
|
const WebRtc_UWord8* payloadData,
|
||||||
const WebRtc_UWord32 payloadSize,
|
const WebRtc_UWord32 payloadSize,
|
||||||
const RTPFragmentationHeader* fragmentation,
|
const RTPFragmentationHeader* fragmentation,
|
||||||
VideoCodecInformation* codecInfo);
|
VideoCodecInformation* codecInfo,
|
||||||
|
const RTPVideoTypeHeader* rtpTypeHdr);
|
||||||
|
|
||||||
WebRtc_Word32 SendRTPIntraRequest();
|
WebRtc_Word32 SendRTPIntraRequest();
|
||||||
|
|
||||||
@ -118,7 +119,9 @@ private:
|
|||||||
const WebRtc_UWord32 captureTimeStamp,
|
const WebRtc_UWord32 captureTimeStamp,
|
||||||
const WebRtc_UWord8* payloadData,
|
const WebRtc_UWord8* payloadData,
|
||||||
const WebRtc_UWord32 payloadSize,
|
const WebRtc_UWord32 payloadSize,
|
||||||
const RTPFragmentationHeader* fragmentation);
|
const RTPFragmentationHeader* fragmentation,
|
||||||
|
const RTPVideoTypeHeader* /*rtpTypeHdr*/);
|
||||||
|
// TODO(hlundin): Remove comments once we start using rtpTypeHdr.
|
||||||
|
|
||||||
// MPEG 4
|
// MPEG 4
|
||||||
WebRtc_Word32 FindMPEG4NALU(const WebRtc_UWord8* inData ,WebRtc_Word32 MaxPayloadLength);
|
WebRtc_Word32 FindMPEG4NALU(const WebRtc_UWord8* inData ,WebRtc_Word32 MaxPayloadLength);
|
||||||
|
@ -148,7 +148,8 @@ WebRtc_Word32 VideoCoder::SendData(
|
|||||||
WebRtc_UWord32 timeStamp,
|
WebRtc_UWord32 timeStamp,
|
||||||
const WebRtc_UWord8* payloadData,
|
const WebRtc_UWord8* payloadData,
|
||||||
WebRtc_UWord32 payloadSize,
|
WebRtc_UWord32 payloadSize,
|
||||||
const RTPFragmentationHeader& fragmentationHeader)
|
const RTPFragmentationHeader& fragmentationHeader,
|
||||||
|
const RTPVideoTypeHeader* rtpTypeHdr)
|
||||||
{
|
{
|
||||||
// Store the data in _videoEncodedData which is a pointer to videoFrame in
|
// Store the data in _videoEncodedData which is a pointer to videoFrame in
|
||||||
// Encode(..)
|
// Encode(..)
|
||||||
|
@ -63,7 +63,8 @@ private:
|
|||||||
const WebRtc_UWord32 /*timeStamp*/,
|
const WebRtc_UWord32 /*timeStamp*/,
|
||||||
const WebRtc_UWord8* payloadData,
|
const WebRtc_UWord8* payloadData,
|
||||||
const WebRtc_UWord32 payloadSize,
|
const WebRtc_UWord32 payloadSize,
|
||||||
const RTPFragmentationHeader& /* fragmentationHeader*/);
|
const RTPFragmentationHeader& /* fragmentationHeader*/,
|
||||||
|
const RTPVideoTypeHeader* rtpTypeHdr);
|
||||||
|
|
||||||
WebRtc_UWord32 _instanceID;
|
WebRtc_UWord32 _instanceID;
|
||||||
VideoCodingModule* _vcm;
|
VideoCodingModule* _vcm;
|
||||||
|
@ -47,7 +47,10 @@ public:
|
|||||||
//
|
//
|
||||||
// Return value : WEBRTC_VIDEO_CODEC_OK if OK
|
// Return value : WEBRTC_VIDEO_CODEC_OK if OK
|
||||||
// <0 - Error
|
// <0 - Error
|
||||||
virtual WebRtc_Word32 Encode(const RawImage& inputImage, const void* /*codecSpecificInfo*/, VideoFrameType /*frameType*/);
|
virtual WebRtc_Word32
|
||||||
|
Encode(const RawImage& inputImage,
|
||||||
|
const CodecSpecificInfo* /*codecSpecificInfo*/,
|
||||||
|
VideoFrameType /*frameType*/);
|
||||||
|
|
||||||
// Register an encode complete callback object.
|
// Register an encode complete callback object.
|
||||||
//
|
//
|
||||||
|
@ -117,7 +117,9 @@ I420Encoder::InitEncode(const VideoCodec* codecSettings,
|
|||||||
|
|
||||||
|
|
||||||
WebRtc_Word32
|
WebRtc_Word32
|
||||||
I420Encoder::Encode(const RawImage& inputImage, const void* /*codecSpecificInfo*/, VideoFrameType /*frameTypes*/)
|
I420Encoder::Encode(const RawImage& inputImage,
|
||||||
|
const CodecSpecificInfo* /*codecSpecificInfo*/,
|
||||||
|
VideoFrameType /*frameTypes*/)
|
||||||
{
|
{
|
||||||
if (!_inited)
|
if (!_inited)
|
||||||
{
|
{
|
||||||
|
@ -54,8 +54,9 @@ public:
|
|||||||
// should be dropped to keep bit rate or frame rate.
|
// should be dropped to keep bit rate or frame rate.
|
||||||
// = 0, if OK.
|
// = 0, if OK.
|
||||||
// < 0, on error.
|
// < 0, on error.
|
||||||
virtual WebRtc_Word32 Encoded(EncodedImage& encodedImage,
|
virtual WebRtc_Word32
|
||||||
const void* codecSpecificInfo = NULL,
|
Encoded(EncodedImage& encodedImage,
|
||||||
|
const CodecSpecificInfo* codecSpecificInfo = NULL,
|
||||||
const RTPFragmentationHeader* fragmentation = NULL) = 0;
|
const RTPFragmentationHeader* fragmentation = NULL) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -96,8 +97,9 @@ public:
|
|||||||
// - frameType : The frame type to encode
|
// - frameType : The frame type to encode
|
||||||
//
|
//
|
||||||
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
||||||
virtual WebRtc_Word32 Encode(const RawImage& inputImage,
|
virtual WebRtc_Word32
|
||||||
const void* codecSpecificInfo = NULL,
|
Encode(const RawImage& inputImage,
|
||||||
|
const CodecSpecificInfo* codecSpecificInfo = NULL,
|
||||||
VideoFrameType frameType = kDeltaFrame) = 0;
|
VideoFrameType frameType = kDeltaFrame) = 0;
|
||||||
|
|
||||||
// Register an encode complete callback object.
|
// Register an encode complete callback object.
|
||||||
|
@ -87,7 +87,7 @@ public:
|
|||||||
// WEBRTC_VIDEO_CODEC_TIMEOUT
|
// WEBRTC_VIDEO_CODEC_TIMEOUT
|
||||||
|
|
||||||
virtual WebRtc_Word32 Encode(const RawImage& inputImage,
|
virtual WebRtc_Word32 Encode(const RawImage& inputImage,
|
||||||
const void* codecSpecificInfo,
|
const CodecSpecificInfo* codecSpecificInfo,
|
||||||
VideoFrameType frameType);
|
VideoFrameType frameType);
|
||||||
|
|
||||||
// Register an encode complete callback object.
|
// Register an encode complete callback object.
|
||||||
|
@ -376,7 +376,7 @@ VP8Encoder::MaxIntraTarget(WebRtc_Word32 optimalBuffersize)
|
|||||||
|
|
||||||
WebRtc_Word32
|
WebRtc_Word32
|
||||||
VP8Encoder::Encode(const RawImage& inputImage,
|
VP8Encoder::Encode(const RawImage& inputImage,
|
||||||
const void* codecSpecificInfo,
|
const CodecSpecificInfo* codecSpecificInfo,
|
||||||
VideoFrameType frameTypes)
|
VideoFrameType frameTypes)
|
||||||
{
|
{
|
||||||
if (!_inited)
|
if (!_inited)
|
||||||
|
@ -20,6 +20,7 @@ namespace webrtc
|
|||||||
|
|
||||||
class VideoEncoder;
|
class VideoEncoder;
|
||||||
class VideoDecoder;
|
class VideoDecoder;
|
||||||
|
struct CodecSpecificInfo;
|
||||||
|
|
||||||
class VideoCodingModule : public Module
|
class VideoCodingModule : public Module
|
||||||
{
|
{
|
||||||
@ -234,9 +235,10 @@ public:
|
|||||||
//
|
//
|
||||||
// Return value : VCM_OK, on success.
|
// Return value : VCM_OK, on success.
|
||||||
// < 0, on error.
|
// < 0, on error.
|
||||||
virtual WebRtc_Word32 AddVideoFrame(const VideoFrame& videoFrame,
|
virtual WebRtc_Word32 AddVideoFrame(
|
||||||
|
const VideoFrame& videoFrame,
|
||||||
const VideoContentMetrics* _contentMetrics = NULL,
|
const VideoContentMetrics* _contentMetrics = NULL,
|
||||||
const void* codecSpecificInfo = NULL) = 0;
|
const CodecSpecificInfo* codecSpecificInfo = NULL) = 0;
|
||||||
|
|
||||||
// Next frame encoded should be of the type frameType.
|
// Next frame encoded should be of the type frameType.
|
||||||
//
|
//
|
||||||
|
@ -82,12 +82,14 @@ struct VCMFrameCount
|
|||||||
class VCMPacketizationCallback
|
class VCMPacketizationCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual WebRtc_Word32 SendData(const FrameType frameType,
|
virtual WebRtc_Word32 SendData(
|
||||||
|
const FrameType frameType,
|
||||||
const WebRtc_UWord8 payloadType,
|
const WebRtc_UWord8 payloadType,
|
||||||
const WebRtc_UWord32 timeStamp,
|
const WebRtc_UWord32 timeStamp,
|
||||||
const WebRtc_UWord8* payloadData,
|
const WebRtc_UWord8* payloadData,
|
||||||
const WebRtc_UWord32 payloadSize,
|
const WebRtc_UWord32 payloadSize,
|
||||||
const RTPFragmentationHeader& fragmentationHeader) = 0;
|
const RTPFragmentationHeader& fragmentationHeader,
|
||||||
|
const RTPVideoTypeHeader* rtpTypeHdr) = 0;
|
||||||
protected:
|
protected:
|
||||||
virtual ~VCMPacketizationCallback() {}
|
virtual ~VCMPacketizationCallback() {}
|
||||||
};
|
};
|
||||||
|
@ -64,7 +64,9 @@ VCMGenericEncoder::InitEncode(const VideoCodec* settings, WebRtc_Word32 numberOf
|
|||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32
|
WebRtc_Word32
|
||||||
VCMGenericEncoder::Encode(const VideoFrame& inputFrame, const void* codecSpecificInfo, FrameType frameType)
|
VCMGenericEncoder::Encode(const VideoFrame& inputFrame,
|
||||||
|
const CodecSpecificInfo* codecSpecificInfo,
|
||||||
|
FrameType frameType)
|
||||||
{
|
{
|
||||||
RawImage rawImage(inputFrame.Buffer(), inputFrame.Length(), inputFrame.Size());
|
RawImage rawImage(inputFrame.Buffer(), inputFrame.Length(), inputFrame.Size());
|
||||||
rawImage._width = inputFrame.Width();
|
rawImage._width = inputFrame.Width();
|
||||||
@ -174,7 +176,9 @@ VCMEncodedFrameCallback::SetTransportCallback(VCMPacketizationCallback* transpor
|
|||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32
|
WebRtc_Word32
|
||||||
VCMEncodedFrameCallback::Encoded(EncodedImage &encodedImage, const void* codecSpecificInfo,
|
VCMEncodedFrameCallback::Encoded(
|
||||||
|
EncodedImage &encodedImage,
|
||||||
|
const CodecSpecificInfo* codecSpecificInfo,
|
||||||
const RTPFragmentationHeader* fragmentationHeader)
|
const RTPFragmentationHeader* fragmentationHeader)
|
||||||
{
|
{
|
||||||
FrameType frameType = VCMEncodedFrame::ConvertFrameType(encodedImage._frameType);
|
FrameType frameType = VCMEncodedFrame::ConvertFrameType(encodedImage._frameType);
|
||||||
@ -189,12 +193,25 @@ VCMEncodedFrameCallback::Encoded(EncodedImage &encodedImage, const void* codecSp
|
|||||||
fwrite(encodedImage._buffer, 1, encodedImage._length, _bitStreamAfterEncoder);
|
fwrite(encodedImage._buffer, 1, encodedImage._length, _bitStreamAfterEncoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32 callbackReturn = _sendCallback->SendData(frameType,
|
RTPVideoTypeHeader rtpTypeHeader;
|
||||||
|
RTPVideoTypeHeader* rtpTypeHeaderPtr = &rtpTypeHeader;
|
||||||
|
if (codecSpecificInfo)
|
||||||
|
{
|
||||||
|
CopyCodecSpecific(*codecSpecificInfo, &rtpTypeHeaderPtr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rtpTypeHeaderPtr = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
WebRtc_Word32 callbackReturn = _sendCallback->SendData(
|
||||||
|
frameType,
|
||||||
_payloadType,
|
_payloadType,
|
||||||
encodedImage._timeStamp,
|
encodedImage._timeStamp,
|
||||||
encodedImage._buffer,
|
encodedImage._buffer,
|
||||||
encodedBytes,
|
encodedBytes,
|
||||||
*fragmentationHeader);
|
*fragmentationHeader,
|
||||||
|
rtpTypeHeaderPtr);
|
||||||
if (callbackReturn < 0)
|
if (callbackReturn < 0)
|
||||||
{
|
{
|
||||||
return callbackReturn;
|
return callbackReturn;
|
||||||
@ -226,4 +243,18 @@ VCMEncodedFrameCallback::SetMediaOpt(VCMMediaOptimization *mediaOpt)
|
|||||||
_mediaOpt = mediaOpt;
|
_mediaOpt = mediaOpt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VCMEncodedFrameCallback::CopyCodecSpecific(const CodecSpecificInfo& info,
|
||||||
|
RTPVideoTypeHeader** rtp) {
|
||||||
|
switch (info.codecType)
|
||||||
|
{
|
||||||
|
//TODO(hlundin): Implement case for kVideoCodecVP8.
|
||||||
|
default: {
|
||||||
|
// No codec specific info. Change RTP header pointer to NULL.
|
||||||
|
*rtp = NULL;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace webrtc
|
||||||
|
@ -32,7 +32,9 @@ public:
|
|||||||
/*
|
/*
|
||||||
* Callback implementation - codec encode complete
|
* Callback implementation - codec encode complete
|
||||||
*/
|
*/
|
||||||
WebRtc_Word32 Encoded(EncodedImage& encodedImage, const void* codecSpecificInfo = NULL,
|
WebRtc_Word32 Encoded(
|
||||||
|
EncodedImage& encodedImage,
|
||||||
|
const CodecSpecificInfo* codecSpecificInfo = NULL,
|
||||||
const RTPFragmentationHeader* fragmentationHeader = NULL);
|
const RTPFragmentationHeader* fragmentationHeader = NULL);
|
||||||
/*
|
/*
|
||||||
* Get number of encoded bytes
|
* Get number of encoded bytes
|
||||||
@ -52,6 +54,13 @@ public:
|
|||||||
void SetInternalSource(bool internalSource) { _internalSource = internalSource; };
|
void SetInternalSource(bool internalSource) { _internalSource = internalSource; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/*
|
||||||
|
* Map information from info into rtp. If no relevant information is found
|
||||||
|
* in info, rtp is set to NULL.
|
||||||
|
*/
|
||||||
|
static void CopyCodecSpecific(const CodecSpecificInfo& info,
|
||||||
|
RTPVideoTypeHeader** rtp);
|
||||||
|
|
||||||
VCMPacketizationCallback* _sendCallback;
|
VCMPacketizationCallback* _sendCallback;
|
||||||
VCMMediaOptimization* _mediaOpt;
|
VCMMediaOptimization* _mediaOpt;
|
||||||
WebRtc_UWord32 _encodedBytes;
|
WebRtc_UWord32 _encodedBytes;
|
||||||
@ -59,7 +68,6 @@ private:
|
|||||||
VideoCodecType _codecType;
|
VideoCodecType _codecType;
|
||||||
bool _internalSource;
|
bool _internalSource;
|
||||||
FILE* _bitStreamAfterEncoder;
|
FILE* _bitStreamAfterEncoder;
|
||||||
|
|
||||||
};// end of VCMEncodeFrameCallback class
|
};// end of VCMEncodeFrameCallback class
|
||||||
|
|
||||||
|
|
||||||
@ -94,7 +102,7 @@ public:
|
|||||||
* frameType : The requested frame type to encode
|
* frameType : The requested frame type to encode
|
||||||
*/
|
*/
|
||||||
WebRtc_Word32 Encode(const VideoFrame& inputFrame,
|
WebRtc_Word32 Encode(const VideoFrame& inputFrame,
|
||||||
const void* codecSpecificInfo,
|
const CodecSpecificInfo* codecSpecificInfo,
|
||||||
FrameType frameType);
|
FrameType frameType);
|
||||||
/**
|
/**
|
||||||
* Set new target bit rate and frame rate
|
* Set new target bit rate and frame rate
|
||||||
|
@ -708,7 +708,7 @@ VideoCodingModuleImpl::SetVideoProtection(VCMVideoProtection videoProtection, bo
|
|||||||
WebRtc_Word32
|
WebRtc_Word32
|
||||||
VideoCodingModuleImpl::AddVideoFrame(const VideoFrame& videoFrame,
|
VideoCodingModuleImpl::AddVideoFrame(const VideoFrame& videoFrame,
|
||||||
const VideoContentMetrics* _contentMetrics,
|
const VideoContentMetrics* _contentMetrics,
|
||||||
const void* codecSpecificInfo)
|
const CodecSpecificInfo* codecSpecificInfo)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceVideoCoding, VCMId(_id), "AddVideoFrame()");
|
WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceVideoCoding, VCMId(_id), "AddVideoFrame()");
|
||||||
CriticalSectionScoped cs(_sendCritSect);
|
CriticalSectionScoped cs(_sendCritSect);
|
||||||
|
@ -132,9 +132,10 @@ public:
|
|||||||
virtual WebRtc_Word32 SetVideoProtection(VCMVideoProtection videoProtection, bool enable);
|
virtual WebRtc_Word32 SetVideoProtection(VCMVideoProtection videoProtection, bool enable);
|
||||||
|
|
||||||
// Add one raw video frame to the encoder, blocking.
|
// Add one raw video frame to the encoder, blocking.
|
||||||
virtual WebRtc_Word32 AddVideoFrame(const VideoFrame& videoFrame,
|
virtual WebRtc_Word32 AddVideoFrame(
|
||||||
|
const VideoFrame& videoFrame,
|
||||||
const VideoContentMetrics* _contentMetrics = NULL,
|
const VideoContentMetrics* _contentMetrics = NULL,
|
||||||
const void* codecSpecificInfo = NULL);
|
const CodecSpecificInfo* codecSpecificInfo = NULL);
|
||||||
|
|
||||||
// Next frame encoded should be of the type frameType.
|
// Next frame encoded should be of the type frameType.
|
||||||
virtual WebRtc_Word32 FrameTypeRequest(FrameType frameType);
|
virtual WebRtc_Word32 FrameTypeRequest(FrameType frameType);
|
||||||
|
@ -900,8 +900,9 @@ WebRtc_Word32 ViECapturer::InitEncode(const VideoCodec* codecSettings,
|
|||||||
* Encode
|
* Encode
|
||||||
* Orders the Capture device to create a certain frame type.
|
* Orders the Capture device to create a certain frame type.
|
||||||
*/
|
*/
|
||||||
WebRtc_Word32 ViECapturer::Encode(const RawImage& inputImage,
|
WebRtc_Word32
|
||||||
const void* codecSpecificInfo, /*= NULL,*/
|
ViECapturer::Encode(const RawImage& inputImage,
|
||||||
|
const CodecSpecificInfo* codecSpecificInfo, /*= NULL,*/
|
||||||
VideoFrameType frameType /*= kDeltaFrame*/)
|
VideoFrameType frameType /*= kDeltaFrame*/)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -125,7 +125,8 @@ protected:
|
|||||||
WebRtc_Word32 numberOfCores,
|
WebRtc_Word32 numberOfCores,
|
||||||
WebRtc_UWord32 maxPayloadSize);
|
WebRtc_UWord32 maxPayloadSize);
|
||||||
virtual WebRtc_Word32 Encode(const RawImage& inputImage,
|
virtual WebRtc_Word32 Encode(const RawImage& inputImage,
|
||||||
const void* codecSpecificInfo = NULL,
|
const CodecSpecificInfo* codecSpecificInfo =
|
||||||
|
NULL,
|
||||||
VideoFrameType frameType = kDeltaFrame);
|
VideoFrameType frameType = kDeltaFrame);
|
||||||
virtual WebRtc_Word32 RegisterEncodeCompleteCallback(
|
virtual WebRtc_Word32 RegisterEncodeCompleteCallback(
|
||||||
EncodedImageCallback* callback);
|
EncodedImageCallback* callback);
|
||||||
|
@ -767,12 +767,14 @@ WebRtc_Word32 ViEEncoder::UpdateProtectionMethod()
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// SendData
|
// SendData
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
WebRtc_Word32 ViEEncoder::SendData(const FrameType frameType,
|
WebRtc_Word32
|
||||||
|
ViEEncoder::SendData(const FrameType frameType,
|
||||||
const WebRtc_UWord8 payloadType,
|
const WebRtc_UWord8 payloadType,
|
||||||
const WebRtc_UWord32 timeStamp,
|
const WebRtc_UWord32 timeStamp,
|
||||||
const WebRtc_UWord8* payloadData,
|
const WebRtc_UWord8* payloadData,
|
||||||
const WebRtc_UWord32 payloadSize,
|
const WebRtc_UWord32 payloadSize,
|
||||||
const webrtc::RTPFragmentationHeader& fragmentationHeader)
|
const webrtc::RTPFragmentationHeader& fragmentationHeader,
|
||||||
|
const RTPVideoTypeHeader* rtpTypeHdr)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(_dataCritsect);
|
CriticalSectionScoped cs(_dataCritsect);
|
||||||
@ -793,7 +795,8 @@ WebRtc_Word32 ViEEncoder::SendData(const FrameType frameType,
|
|||||||
WebRtc_Word32 retVal = _rtpRtcp.SendOutgoingData(frameType, payloadType,
|
WebRtc_Word32 retVal = _rtpRtcp.SendOutgoingData(frameType, payloadType,
|
||||||
timeStamp, payloadData,
|
timeStamp, payloadData,
|
||||||
payloadSize,
|
payloadSize,
|
||||||
&fragmentationHeader);
|
&fragmentationHeader,
|
||||||
|
rtpTypeHdr);
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,12 +86,14 @@ public:
|
|||||||
// Loss protection
|
// Loss protection
|
||||||
WebRtc_Word32 UpdateProtectionMethod();
|
WebRtc_Word32 UpdateProtectionMethod();
|
||||||
// Implements VCMPacketizationCallback
|
// Implements VCMPacketizationCallback
|
||||||
virtual WebRtc_Word32 SendData(const FrameType frameType,
|
virtual WebRtc_Word32
|
||||||
|
SendData(const FrameType frameType,
|
||||||
const WebRtc_UWord8 payloadType,
|
const WebRtc_UWord8 payloadType,
|
||||||
const WebRtc_UWord32 timeStamp,
|
const WebRtc_UWord32 timeStamp,
|
||||||
const WebRtc_UWord8* payloadData,
|
const WebRtc_UWord8* payloadData,
|
||||||
const WebRtc_UWord32 payloadSize,
|
const WebRtc_UWord32 payloadSize,
|
||||||
const RTPFragmentationHeader& fragmentationHeader);
|
const RTPFragmentationHeader& fragmentationHeader,
|
||||||
|
const RTPVideoTypeHeader* rtpTypeHdr);
|
||||||
// Implements VideoProtectionCallback
|
// Implements VideoProtectionCallback
|
||||||
virtual WebRtc_Word32 ProtectionRequest(const WebRtc_UWord8 deltaFECRate,
|
virtual WebRtc_Word32 ProtectionRequest(const WebRtc_UWord8 deltaFECRate,
|
||||||
const WebRtc_UWord8 keyFECRate,
|
const WebRtc_UWord8 keyFECRate,
|
||||||
|
Reference in New Issue
Block a user