1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

for bug #66, use new api to directly sendout h264 raw data.

This commit is contained in:
winlin 2014-11-08 09:12:52 +08:00
parent 496f4246f4
commit 1074c8d9b2
3 changed files with 34 additions and 34 deletions

View file

@ -157,18 +157,9 @@ int main(int argc, char** argv)
goto rtmp_destroy;
}
// convert the h264 packet to rtmp packet.
char* rtmp_data = NULL;
int rtmp_size = 0;
u_int32_t timestamp = 0;
if (srs_h264_to_rtmp(data, size, dts, pts, &rtmp_data, &rtmp_size, &timestamp) != 0) {
srs_trace("h264 raw data to rtmp data failed.");
goto rtmp_destroy;
}
// send out the rtmp packet.
int type = SRS_RTMP_TYPE_VIDEO;
if (srs_write_packet(rtmp, type, timestamp, rtmp_data, rtmp_size) != 0) {
// send out the h264 packet over RTMP
if (srs_write_h264_raw_frame(rtmp, data, size, dts, pts) != 0) {
srs_trace("send h264 raw data failed.");
goto rtmp_destroy;
}
@ -176,7 +167,7 @@ int main(int argc, char** argv)
// H.264-AVC-ISO_IEC_14496-10.pdf, page 44.
u_int8_t nut = (char)data[0] & 0x1f;
srs_trace("sent packet: type=%s, time=%d, size=%d, fps=%d, b[0]=%#x(%s)",
srs_type2string(type), timestamp, rtmp_size, fps, nut,
srs_type2string(SRS_RTMP_TYPE_VIDEO), dts, size, fps, nut,
(nut == 7? "SPS":(nut == 8? "PPS":(nut == 5? "I":(nut == 1? "P":"Unknown")))));
// @remark, when use encode device, it not need to sleep.