正在显示
1 个修改的文件
包含
11 行增加
和
11 行删除
@@ -72,7 +72,7 @@ struct Context | @@ -72,7 +72,7 @@ struct Context | ||
72 | 72 | ||
73 | // for h264 raw stream, | 73 | // for h264 raw stream, |
74 | // see: https://github.com/winlinvip/simple-rtmp-server/issues/66#issuecomment-62240521 | 74 | // see: https://github.com/winlinvip/simple-rtmp-server/issues/66#issuecomment-62240521 |
75 | - SrsStream raw_stream; | 75 | + SrsStream h264_raw_stream; |
76 | // about SPS, @see: 7.3.2.1.1, H.264-AVC-ISO_IEC_14496-10-2012.pdf, page 62 | 76 | // about SPS, @see: 7.3.2.1.1, H.264-AVC-ISO_IEC_14496-10-2012.pdf, page 62 |
77 | std::string h264_sps; | 77 | std::string h264_sps; |
78 | std::string h264_pps; | 78 | std::string h264_pps; |
@@ -1337,32 +1337,32 @@ int srs_h264_write_raw_frames(srs_rtmp_t rtmp, | @@ -1337,32 +1337,32 @@ int srs_h264_write_raw_frames(srs_rtmp_t rtmp, | ||
1337 | srs_assert(rtmp != NULL); | 1337 | srs_assert(rtmp != NULL); |
1338 | Context* context = (Context*)rtmp; | 1338 | Context* context = (Context*)rtmp; |
1339 | 1339 | ||
1340 | - if ((ret = context->raw_stream.initialize(frames, frames_size)) != ERROR_SUCCESS) { | 1340 | + if ((ret = context->h264_raw_stream.initialize(frames, frames_size)) != ERROR_SUCCESS) { |
1341 | return ret; | 1341 | return ret; |
1342 | } | 1342 | } |
1343 | 1343 | ||
1344 | // send each frame. | 1344 | // send each frame. |
1345 | - while (!context->raw_stream.empty()) { | 1345 | + while (!context->h264_raw_stream.empty()) { |
1346 | // each frame must prefixed by annexb format. | 1346 | // each frame must prefixed by annexb format. |
1347 | // about annexb, @see H.264-AVC-ISO_IEC_14496-10.pdf, page 211. | 1347 | // about annexb, @see H.264-AVC-ISO_IEC_14496-10.pdf, page 211. |
1348 | int pnb_start_code = 0; | 1348 | int pnb_start_code = 0; |
1349 | - if (!srs_avc_startswith_annexb(&context->raw_stream, &pnb_start_code)) { | 1349 | + if (!srs_avc_startswith_annexb(&context->h264_raw_stream, &pnb_start_code)) { |
1350 | return ERROR_H264_API_NO_PREFIXED; | 1350 | return ERROR_H264_API_NO_PREFIXED; |
1351 | } | 1351 | } |
1352 | - int start = context->raw_stream.pos() + pnb_start_code; | 1352 | + int start = context->h264_raw_stream.pos() + pnb_start_code; |
1353 | 1353 | ||
1354 | // find the last frame prefixed by annexb format. | 1354 | // find the last frame prefixed by annexb format. |
1355 | - context->raw_stream.skip(pnb_start_code); | ||
1356 | - while (!context->raw_stream.empty()) { | ||
1357 | - if (srs_avc_startswith_annexb(&context->raw_stream, NULL)) { | 1355 | + context->h264_raw_stream.skip(pnb_start_code); |
1356 | + while (!context->h264_raw_stream.empty()) { | ||
1357 | + if (srs_avc_startswith_annexb(&context->h264_raw_stream, NULL)) { | ||
1358 | break; | 1358 | break; |
1359 | } | 1359 | } |
1360 | - context->raw_stream.skip(1); | 1360 | + context->h264_raw_stream.skip(1); |
1361 | } | 1361 | } |
1362 | - int size = context->raw_stream.pos() - start; | 1362 | + int size = context->h264_raw_stream.pos() - start; |
1363 | 1363 | ||
1364 | // send out the frame. | 1364 | // send out the frame. |
1365 | - char* frame = context->raw_stream.data() + start; | 1365 | + char* frame = context->h264_raw_stream.data() + start; |
1366 | if ((ret = __srs_write_h264_raw_frame(context, frame, size, dts, pts)) != ERROR_SUCCESS) { | 1366 | if ((ret = __srs_write_h264_raw_frame(context, frame, size, dts, pts)) != ERROR_SUCCESS) { |
1367 | return ret; | 1367 | return ret; |
1368 | } | 1368 | } |
-
请 注册 或 登录 后发表评论