summaryrefslogtreecommitdiff
path: root/pjmedia
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2014-03-28 07:44:31 +0000
committerNanang Izzuddin <nanang@teluu.com>2014-03-28 07:44:31 +0000
commit16e91574526a166be70846afe560f026f27a02a8 (patch)
treed1503155882f1978ef623fd99256bb013d4e52e9 /pjmedia
parent30db127b26e6f805b7723c8bff1e6803b2bb2b6e (diff)
Fix #1754: Fixed crash in video stream when encoder returns zero payload length.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4805 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r--pjmedia/src/pjmedia/vid_stream.c47
1 files changed, 26 insertions, 21 deletions
diff --git a/pjmedia/src/pjmedia/vid_stream.c b/pjmedia/src/pjmedia/vid_stream.c
index b6cc36dc..9a9aff90 100644
--- a/pjmedia/src/pjmedia/vid_stream.c
+++ b/pjmedia/src/pjmedia/vid_stream.c
@@ -880,29 +880,34 @@ static pj_status_t put_frame(pjmedia_port *port,
return status;
}
- // Copy RTP header to the beginning of packet
- pj_memcpy(channel->buf, rtphdr, sizeof(pjmedia_rtp_hdr));
-
- // Send the RTP packet to the transport.
- status = pjmedia_transport_send_rtp(stream->transport,
- (char*)channel->buf,
- frame_out.size +
- sizeof(pjmedia_rtp_hdr));
- if (status != PJ_SUCCESS) {
- enum { COUNT_TO_REPORT = 20 };
- if (stream->send_err_cnt++ == 0) {
- LOGERR_((channel->port.info.name.ptr,
- "Transport send_rtp() error",
- status));
+ /* When the payload length is zero, we should not send anything,
+ * but proceed the rest normally.
+ */
+ if (frame_out.size != 0) {
+ // Copy RTP header to the beginning of packet
+ pj_memcpy(channel->buf, rtphdr, sizeof(pjmedia_rtp_hdr));
+
+ // Send the RTP packet to the transport.
+ status = pjmedia_transport_send_rtp(stream->transport,
+ (char*)channel->buf,
+ frame_out.size +
+ sizeof(pjmedia_rtp_hdr));
+ if (status != PJ_SUCCESS) {
+ enum { COUNT_TO_REPORT = 20 };
+ if (stream->send_err_cnt++ == 0) {
+ LOGERR_((channel->port.info.name.ptr,
+ "Transport send_rtp() error",
+ status));
+ }
+ if (stream->send_err_cnt > COUNT_TO_REPORT)
+ stream->send_err_cnt = 0;
+ /* Ignore this error */
}
- if (stream->send_err_cnt > COUNT_TO_REPORT)
- stream->send_err_cnt = 0;
- /* Ignore this error */
- }
- pjmedia_rtcp_tx_rtp(&stream->rtcp, (unsigned)frame_out.size);
- total_sent += frame_out.size;
- pkt_cnt++;
+ pjmedia_rtcp_tx_rtp(&stream->rtcp, (unsigned)frame_out.size);
+ total_sent += frame_out.size;
+ pkt_cnt++;
+ }
if (!has_more_data)
break;