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

for bug #66, refine the api and demo.

This commit is contained in:
winlin 2014-11-08 09:21:09 +08:00
parent 1074c8d9b2
commit cd5c58ba5f
3 changed files with 22 additions and 25 deletions

View file

@ -70,9 +70,6 @@ struct Context
SimpleSocketStream* skt;
int stream_id;
// for h264 raw stream
SrsStream raw_stream;
Context() {
rtmp = NULL;
skt = NULL;
@ -1003,15 +1000,15 @@ int srs_write_h264_raw_frame(srs_rtmp_t rtmp, char* frame, int frame_size, u_int
{
int ret = ERROR_SUCCESS;
srs_assert(frame_size > 0);
srs_assert(frame_size > 1);
srs_assert(rtmp != NULL);
Context* context = (Context*)rtmp;
if ((ret = context->raw_stream.initialize(frame, frame_size)) != ERROR_SUCCESS) {
return ret;
}
// 5bits, 7.3.1 NAL unit syntax,
// H.264-AVC-ISO_IEC_14496-10.pdf, page 44.
// 7: SPS, 8: PPS, 5: I Frame, 1: P Frame
u_int8_t nal_unit_type = (char)frame[0] & 0x1f;
/*// the timestamp in rtmp message header is dts.
u_int32_t timestamp = dts;
@ -1025,11 +1022,6 @@ int srs_write_h264_raw_frame(srs_rtmp_t rtmp, char* frame, int frame_size, u_int
char* data = new char[size];
memcpy(data + 5, h264_raw_data, h264_raw_size);
// 5bits, 7.3.1 NAL unit syntax,
// H.264-AVC-ISO_IEC_14496-10.pdf, page 44.
// 7: SPS, 8: PPS, 5: I Frame, 1: P Frame
u_int8_t nal_unit_type = (char)h264_raw_data[0] & 0x1f;
// Frame Type, Type of video frame.
// @see: E.4.3 Video Tags, video_file_format_spec_v10_1.pdf, page 78
int8_t frame_type = SrsCodecVideoAVCFrameInterFrame;

View file

@ -337,11 +337,12 @@ extern char* srs_amf0_human_print(srs_amf0_t amf0, char** pdata, int* psize);
**************************************************************
*************************************************************/
/**
* write h.264 raw frame to rtmp server.
* write h.264 raw frame over RTMP to rtmp server.
* @param frame the input h264 raw data, an encoded h.264 I/P/B frame data.
* it must be prefixed by h.264 annexb format, by N[00] 00 00 01, where N>=0,
* for instance, 00 00 00 01 67 42 80 29 95 A0 14 01 6E 40
* @paam frame_size the size of h264 raw data. assert frame_size > 0.
* the frame without h.264 annexb header, by N[00] 00 00 01, where N>=0,
* for instance, header(00 00 00 01) + frame(67 42 80 29 95 A0 14 01 6E 40)
* @paam frame_size the size of h264 raw data.
* assert frame_size > 1, at least has 1 bytes header.
* @param dts the dts of h.264 raw data.
* @param pts the pts of h.264 raw data.
*