Skip to content

Commit

Permalink
WebRTC: Add error tips when coverting HEVC to RTC.(ossrs#3407)
Browse files Browse the repository at this point in the history
  • Loading branch information
chundonglinlin committed Feb 15, 2023
1 parent 4a5f479 commit 6d8df10
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
12 changes: 5 additions & 7 deletions trunk/src/app/srs_app_rtc_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -974,13 +974,6 @@ srs_error_t SrsRtcFromRtmpBridge::on_video(SrsSharedPtrMessage* msg)
return err;
}

// WebRTC NOT support HEVC.
#ifdef SRS_H265
if (format->vcodec->id == SrsVideoCodecIdHEVC) {
return err;
}
#endif

// cache the sequence header if h264
bool is_sequence_header = SrsFlvVideo::sh(msg->payload, msg->size);
if (is_sequence_header && (err = meta->update_vsh(msg)) != srs_success) {
Expand All @@ -997,6 +990,11 @@ srs_error_t SrsRtcFromRtmpBridge::on_video(SrsSharedPtrMessage* msg)
return err;
}

// WebRTC NOT support HEVC, RTMP NOT support VP8/VP9.
if (format->vcodec->id != SrsVideoCodecIdAVC && format->vcodec->id != SrsVideoCodecIdAV1) {
return srs_error_new(ERROR_RTC_CODEC_ERROR, "WebRTC not support %s", srs_video_codec_id2str(format->vcodec->id).c_str());
}

bool has_idr = false;
vector<SrsSample*> samples;
if ((err = filter(msg, format, has_idr, samples)) != srs_success) {
Expand Down
3 changes: 2 additions & 1 deletion trunk/src/kernel/srs_kernel_error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,8 @@
XX(ERROR_RTC_TCP_SIZE , 5032, "RtcTcpSize", "RTC TCP packet size is invalid") \
XX(ERROR_RTC_TCP_PACKET , 5033, "RtcTcpStun", "RTC TCP first packet must be STUN") \
XX(ERROR_RTC_TCP_STUN , 5034, "RtcTcpSession", "RTC TCP packet is invalid for session not found") \
XX(ERROR_RTC_TCP_UNIQUE , 5035, "RtcUnique", "RTC only support one UDP or TCP network")
XX(ERROR_RTC_TCP_UNIQUE , 5035, "RtcUnique", "RTC only support one UDP or TCP network") \
XX(ERROR_RTC_CODEC_ERROR , 5036, "RtcCodec", "RTC not support codec type")

/**************************************************/
/* SRT protocol error. */
Expand Down

0 comments on commit 6d8df10

Please sign in to comment.