正在显示
3 个修改的文件
包含
17 行增加
和
0 行删除
| @@ -127,6 +127,12 @@ int proxy(srs_rtmp_t irtmp, srs_rtmp_t ortmp) | @@ -127,6 +127,12 @@ int proxy(srs_rtmp_t irtmp, srs_rtmp_t ortmp) | ||
| 127 | return ret; | 127 | return ret; |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | + if (!srs_utils_flv_tag_is_ok(type)) { | ||
| 131 | + srs_human_trace("ignore invalid flv tag=%d, dts=%d, %d bytes", type, timestamp, size); | ||
| 132 | + free(data); | ||
| 133 | + continue; | ||
| 134 | + } | ||
| 135 | + | ||
| 130 | if ((ret = srs_human_print_rtmp_packet(type, timestamp, data, size)) != 0) { | 136 | if ((ret = srs_human_print_rtmp_packet(type, timestamp, data, size)) != 0) { |
| 131 | srs_human_trace("print packet failed. ret=%d", ret); | 137 | srs_human_trace("print packet failed. ret=%d", ret); |
| 132 | return ret; | 138 | return ret; |
| @@ -1974,6 +1974,11 @@ int srs_utils_parse_timestamp( | @@ -1974,6 +1974,11 @@ int srs_utils_parse_timestamp( | ||
| 1974 | return ret; | 1974 | return ret; |
| 1975 | } | 1975 | } |
| 1976 | 1976 | ||
| 1977 | +srs_bool srs_utils_flv_tag_is_ok(char type) | ||
| 1978 | +{ | ||
| 1979 | + return type == SRS_RTMP_TYPE_AUDIO || type == SRS_RTMP_TYPE_VIDEO || type == SRS_RTMP_TYPE_SCRIPT; | ||
| 1980 | +} | ||
| 1981 | + | ||
| 1977 | char srs_utils_flv_video_codec_id(char* data, int size) | 1982 | char srs_utils_flv_video_codec_id(char* data, int size) |
| 1978 | { | 1983 | { |
| 1979 | if (size < 1) { | 1984 | if (size < 1) { |
| @@ -657,6 +657,12 @@ extern int srs_utils_parse_timestamp( | @@ -657,6 +657,12 @@ extern int srs_utils_parse_timestamp( | ||
| 657 | ); | 657 | ); |
| 658 | 658 | ||
| 659 | /** | 659 | /** |
| 660 | + * whether the flv tag specified by param type is ok. | ||
| 661 | + * @return true when tag is video/audio/script-data; otherwise, false. | ||
| 662 | + */ | ||
| 663 | +extern srs_bool srs_utils_flv_tag_is_ok(char type); | ||
| 664 | + | ||
| 665 | +/** | ||
| 660 | * get the CodecID of video tag. | 666 | * get the CodecID of video tag. |
| 661 | * Codec Identifier. The following values are defined: | 667 | * Codec Identifier. The following values are defined: |
| 662 | * 2 = Sorenson H.263 | 668 | * 2 = Sorenson H.263 |
-
请 注册 或 登录 后发表评论