fix #202, fix memory leak of h.264 raw packet send in srs-librtmp. 2.0.20.
正在显示
3 个修改的文件
包含
5 行增加
和
1 行删除
| @@ -244,6 +244,7 @@ Supported operating systems and hardware: | @@ -244,6 +244,7 @@ Supported operating systems and hardware: | ||
| 244 | * 2013-10-17, Created.<br/> | 244 | * 2013-10-17, Created.<br/> |
| 245 | 245 | ||
| 246 | ## History | 246 | ## History |
| 247 | +* v2.0, 2014-11-15, fix [#202](https://github.com/winlinvip/simple-rtmp-server/issues/202), fix memory leak of h.264 raw packet send in srs-librtmp. 2.0.20. | ||
| 247 | * v2.0, 2014-11-13, fix [#200](https://github.com/winlinvip/simple-rtmp-server/issues/200), deadloop when read/write 0 and ETIME. 2.0.16. | 248 | * v2.0, 2014-11-13, fix [#200](https://github.com/winlinvip/simple-rtmp-server/issues/200), deadloop when read/write 0 and ETIME. 2.0.16. |
| 248 | * v2.0, 2014-11-13, fix [#194](https://github.com/winlinvip/simple-rtmp-server/issues/194), writev multiple msgs, support 6k+ 250kbps clients. 2.0.15. | 249 | * v2.0, 2014-11-13, fix [#194](https://github.com/winlinvip/simple-rtmp-server/issues/194), writev multiple msgs, support 6k+ 250kbps clients. 2.0.15. |
| 249 | * v2.0, 2014-11-12, fix [#194](https://github.com/winlinvip/simple-rtmp-server/issues/194), optmized st for timeout recv. pulse to 500ms. 2.0.14. | 250 | * v2.0, 2014-11-12, fix [#194](https://github.com/winlinvip/simple-rtmp-server/issues/194), optmized st for timeout recv. pulse to 500ms. 2.0.14. |
| @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 31 | // current release version | 31 | // current release version |
| 32 | #define VERSION_MAJOR 2 | 32 | #define VERSION_MAJOR 2 |
| 33 | #define VERSION_MINOR 0 | 33 | #define VERSION_MINOR 0 |
| 34 | -#define VERSION_REVISION 19 | 34 | +#define VERSION_REVISION 20 |
| 35 | // server info. | 35 | // server info. |
| 36 | #define RTMP_SIG_SRS_KEY "SRS" | 36 | #define RTMP_SIG_SRS_KEY "SRS" |
| 37 | #define RTMP_SIG_SRS_ROLE "origin/edge server" | 37 | #define RTMP_SIG_SRS_ROLE "origin/edge server" |
| @@ -1075,6 +1075,7 @@ char* srs_amf0_human_print(srs_amf0_t amf0, char** pdata, int* psize) | @@ -1075,6 +1075,7 @@ char* srs_amf0_human_print(srs_amf0_t amf0, char** pdata, int* psize) | ||
| 1075 | * write h264 packet, with rtmp header. | 1075 | * write h264 packet, with rtmp header. |
| 1076 | * @param frame_type, SrsCodecVideoAVCFrameKeyFrame or SrsCodecVideoAVCFrameInterFrame. | 1076 | * @param frame_type, SrsCodecVideoAVCFrameKeyFrame or SrsCodecVideoAVCFrameInterFrame. |
| 1077 | * @param avc_packet_type, SrsCodecVideoAVCTypeSequenceHeader or SrsCodecVideoAVCTypeNALU. | 1077 | * @param avc_packet_type, SrsCodecVideoAVCTypeSequenceHeader or SrsCodecVideoAVCTypeNALU. |
| 1078 | +* @param h264_raw_data the h.264 raw data, user must free it. | ||
| 1078 | */ | 1079 | */ |
| 1079 | int __srs_write_h264_packet(Context* context, | 1080 | int __srs_write_h264_packet(Context* context, |
| 1080 | int8_t frame_type, int8_t avc_packet_type, | 1081 | int8_t frame_type, int8_t avc_packet_type, |
| @@ -1142,6 +1143,7 @@ int __srs_write_h264_sps_pps(Context* context, u_int32_t dts, u_int32_t pts) | @@ -1142,6 +1143,7 @@ int __srs_write_h264_sps_pps(Context* context, u_int32_t dts, u_int32_t pts) | ||
| 1142 | + 3 + (int)context->h264_sps.length() | 1143 | + 3 + (int)context->h264_sps.length() |
| 1143 | + 3 + (int)context->h264_pps.length(); | 1144 | + 3 + (int)context->h264_pps.length(); |
| 1144 | char* packet = new char[nb_packet]; | 1145 | char* packet = new char[nb_packet]; |
| 1146 | + SrsAutoFree(char, packet); | ||
| 1145 | 1147 | ||
| 1146 | // use stream to generate the h264 packet. | 1148 | // use stream to generate the h264 packet. |
| 1147 | SrsStream stream; | 1149 | SrsStream stream; |
| @@ -1236,6 +1238,7 @@ int __srs_write_h264_ipb_frame(Context* context, | @@ -1236,6 +1238,7 @@ int __srs_write_h264_ipb_frame(Context* context, | ||
| 1236 | // NALUnit | 1238 | // NALUnit |
| 1237 | int nb_packet = 4 + size; | 1239 | int nb_packet = 4 + size; |
| 1238 | char* packet = new char[nb_packet]; | 1240 | char* packet = new char[nb_packet]; |
| 1241 | + SrsAutoFree(char, packet); | ||
| 1239 | 1242 | ||
| 1240 | // use stream to generate the h264 packet. | 1243 | // use stream to generate the h264 packet. |
| 1241 | SrsStream stream; | 1244 | SrsStream stream; |
-
请 注册 或 登录 后发表评论