Skip to content

Commit

Permalink
fix #2690, 如果发现音频包为空,则不送解码,以免提前结束了解码上下文 (#2757)
Browse files Browse the repository at this point in the history
* fix #2690, 如果发现音频包为空,则不送解码,以免提前结束了解码上下文

* fix #2690,出错信息中,显示相关参数名称

Co-authored-by: jiankai <wangjiankai@cmhi.chinamobile.com>
  • Loading branch information
jamken and jiankai authored Dec 4, 2021
1 parent bc06394 commit 2c0cd9b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions trunk/src/app/srs_app_rtc_codec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,14 @@ srs_error_t SrsAudioTranscoder::decode_and_resample(SrsAudioFrame *pkt)

char err_buf[AV_ERROR_MAX_STRING_SIZE] = {0};


if (dec_packet_->data == NULL || dec_packet_->size == 0){
return srs_error_new(ERROR_RTC_INVALID_PARAMS,
"dec_pakcet is invalide(dec_packet_->data: %p, dec_packet_->size: %d)",
dec_packet_->data, (int) dec_packet_->size);
}


int error = avcodec_send_packet(dec_, dec_packet_);
if (error < 0) {
return srs_error_new(ERROR_RTC_RTP_MUXER, "submit to dec(%d,%s)", error,
Expand Down

0 comments on commit 2c0cd9b

Please sign in to comment.