Changeset 4805 for pjproject


Ignore:
Timestamp:
Mar 28, 2014 7:44:31 AM (10 years ago)
Author:
nanang
Message:

Fix #1754: Fixed crash in video stream when encoder returns zero payload length.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/vid_stream.c

    r4613 r4805  
    881881        } 
    882882 
    883         // Copy RTP header to the beginning of packet 
    884         pj_memcpy(channel->buf, rtphdr, sizeof(pjmedia_rtp_hdr)); 
    885  
    886         // Send the RTP packet to the transport. 
    887         status = pjmedia_transport_send_rtp(stream->transport, 
    888                                             (char*)channel->buf, 
    889                                             frame_out.size + 
    890                                                 sizeof(pjmedia_rtp_hdr)); 
    891         if (status != PJ_SUCCESS) { 
    892             enum { COUNT_TO_REPORT = 20 }; 
    893             if (stream->send_err_cnt++ == 0) { 
    894                 LOGERR_((channel->port.info.name.ptr, 
    895                          "Transport send_rtp() error", 
    896                          status)); 
     883        /* When the payload length is zero, we should not send anything, 
     884         * but proceed the rest normally. 
     885         */ 
     886        if (frame_out.size != 0) { 
     887            // Copy RTP header to the beginning of packet 
     888            pj_memcpy(channel->buf, rtphdr, sizeof(pjmedia_rtp_hdr)); 
     889 
     890            // Send the RTP packet to the transport. 
     891            status = pjmedia_transport_send_rtp(stream->transport, 
     892                                                (char*)channel->buf, 
     893                                                frame_out.size + 
     894                                                    sizeof(pjmedia_rtp_hdr)); 
     895            if (status != PJ_SUCCESS) { 
     896                enum { COUNT_TO_REPORT = 20 }; 
     897                if (stream->send_err_cnt++ == 0) { 
     898                    LOGERR_((channel->port.info.name.ptr, 
     899                             "Transport send_rtp() error", 
     900                             status)); 
     901                } 
     902                if (stream->send_err_cnt > COUNT_TO_REPORT) 
     903                    stream->send_err_cnt = 0; 
     904                /* Ignore this error */ 
    897905            } 
    898             if (stream->send_err_cnt > COUNT_TO_REPORT) 
    899                 stream->send_err_cnt = 0; 
    900             /* Ignore this error */ 
    901         } 
    902  
    903         pjmedia_rtcp_tx_rtp(&stream->rtcp, (unsigned)frame_out.size); 
    904         total_sent += frame_out.size; 
    905         pkt_cnt++; 
     906 
     907            pjmedia_rtcp_tx_rtp(&stream->rtcp, (unsigned)frame_out.size); 
     908            total_sent += frame_out.size; 
     909            pkt_cnt++; 
     910        } 
    906911 
    907912        if (!has_more_data) 
Note: See TracChangeset for help on using the changeset viewer.