Share via


IRTCPluggableVideoEncoder::WriteRTPPayloadHeader (Windows Embedded CE 6.0)

1/6/2010

The WriteRTPPayloadHeader method is called after the filter has encoded the data in order to generate the RTP header or headers. The compressed video itself is specified in the pbEncodedFrame parameter, and WriteRTPPayloadHeader must set the corresponding RTP packet header or headers in the pbPayloadHeader parameter. The data that this function returns is what is ultimately sent over the network. This function is provided for H.263 and H.264 codecs, although you may modify the source code (which will be public) or use your own implementation by changing the EncoderPlugin setting.

If the frame has to be sent in multiple packets, WriteRTPPayloadHeader will be called with the updated value of pPacketCount until *pbLastPacket is set to TRUE. For each call of WriteRTPPayloadHeader, RTP will send a packet with the resulting payload header and the encoded video data corresponding to pdwFrameStartBitOffset and pdwFrameEndBitOffset.

Syntax

HRESULT WriteRTPPayloadHeader(
  IUnknown *pEncoder,
  const CHAR *szFmtp,
  PBYTE pbEncodedFrame,
  DWORD dwEncodedSize,
  DWORD *pdwFrameStartBitOffset,
  DWORD *pdwFrameEndBitOffset,
  BOOL fKeyFrame,
  BYTE *pbPayloadHeader,
  DWORD *pdwPayloadHeaderLength,
  BOOL *pfLastPacket
);

Parameters

  • pEncoder
    [in] Pointer to the codec doing the encoding, ultimately an IBaseFilter
  • szFmtp
    [in] The FMTP line indicated for this payload type in the SDP from the other side
  • pbEncodedFrame
    [in] Pointer to the beginning of the encoded video stream data being packetized
  • dwEncodedSize
    [in] Number of bytes in pbEncodedFrame
  • pdwFrameStartBitOffset
    [in] Bit offset of the beginning of the current frame in pbEncodedFrame; corresponds to beginning of encoded video that should be sent out with this RTP packet
  • pdwFrameEndBitOffset
    [out] Bit offset of the end of the current frame in pbEncodedFrame; corresponds to end of encoded video that should be sent out with this RTP packet
  • fKeyFrame
    [in] Value of TRUE indicates that this is a key frame
  • pbPayloadHeader
    [out] Pointer to buffer to receive formatted RTP payload header
  • pdwPayloadHeaderLength
    [in, out] Length of the pbPayloadHeader data written out during this call
  • pfLastPacket
    [out] Indicates whether this is the last packet RTP packet that has to be sent out with given encoded data. If TRUE is set, RTC will send the packetized data over the network. If FALSE is set, RTC will call into WriteRTPPayloadHeader again.

Return Value

Value Description

S_OK

Indicates success

Remarks

This object does not have to be implemented in the same DLL as the filter itself. For example, consider the case in which an OEM obtains a codec with a filter interface, but no source code, from a third party who did not implement IRTCPluggableVideoEncoder. For example, this could be the case if the filter was not created originally for VOIP. In this scenario the OEM could implement IRTCPluggableVideoEncoder in a separate DLL and perform needed RTP generation, and optionally retrieve configuration options for the RTP packet from the encoder by using the IBaseFilter interface that was passed in.

Requirements

Header RTCVideoPlugin.h
Windows Embedded CE Windows Embedded CE 6.0 R2

See Also

Reference

IRTCPluggableVideoEncoder