正在显示
1 个修改的文件
包含
24 行增加
和
10 行删除
| @@ -1023,16 +1023,6 @@ int SrsProtocol::read_message_header(SrsChunkStream* chunk, char fmt, int bh_siz | @@ -1023,16 +1023,6 @@ int SrsProtocol::read_message_header(SrsChunkStream* chunk, char fmt, int bh_siz | ||
| 1023 | return ret; | 1023 | return ret; |
| 1024 | } | 1024 | } |
| 1025 | 1025 | ||
| 1026 | - // ffmpeg/librtmp may donot send this filed, need to detect the value. | ||
| 1027 | - // @see also: http://blog.csdn.net/win_lin/article/details/13363699 | ||
| 1028 | - // the extended-timestamp must be unsigned-int, | ||
| 1029 | - // 24bits timestamp: 0xffffff = 16777215ms = 16777.215s = 4.66h | ||
| 1030 | - // 32bits timestamp: 0xffffffff = 4294967295ms = 4294967.295s = 1193.046h = 49.71d | ||
| 1031 | - // because the rtmp protocol says the 32bits timestamp is about "50 days": | ||
| 1032 | - // 3. Byte Order, Alignment, and Time Format | ||
| 1033 | - // Because timestamps are generally only 32 bits long, they will roll | ||
| 1034 | - // over after fewer than 50 days. | ||
| 1035 | - // so, use u_int32_t is right. | ||
| 1036 | u_int32_t timestamp = 0x00; | 1026 | u_int32_t timestamp = 0x00; |
| 1037 | char* pp = (char*)×tamp; | 1027 | char* pp = (char*)×tamp; |
| 1038 | pp[3] = *p++; | 1028 | pp[3] = *p++; |
| @@ -1052,6 +1042,30 @@ int SrsProtocol::read_message_header(SrsChunkStream* chunk, char fmt, int bh_siz | @@ -1052,6 +1042,30 @@ int SrsProtocol::read_message_header(SrsChunkStream* chunk, char fmt, int bh_siz | ||
| 1052 | srs_verbose("header read ext_time completed. time=%"PRId64"", chunk->header.timestamp); | 1042 | srs_verbose("header read ext_time completed. time=%"PRId64"", chunk->header.timestamp); |
| 1053 | } | 1043 | } |
| 1054 | 1044 | ||
| 1045 | + // ffmpeg/librtmp may donot send this filed, need to detect the value. | ||
| 1046 | + // @see also: http://blog.csdn.net/win_lin/article/details/13363699 | ||
| 1047 | + // the extended-timestamp must be unsigned-int, | ||
| 1048 | + // 24bits timestamp: 0xffffff = 16777215ms = 16777.215s = 4.66h | ||
| 1049 | + // 32bits timestamp: 0xffffffff = 4294967295ms = 4294967.295s = 1193.046h = 49.71d | ||
| 1050 | + // because the rtmp protocol says the 32bits timestamp is about "50 days": | ||
| 1051 | + // 3. Byte Order, Alignment, and Time Format | ||
| 1052 | + // Because timestamps are generally only 32 bits long, they will roll | ||
| 1053 | + // over after fewer than 50 days. | ||
| 1054 | + // | ||
| 1055 | + // but, its sample says the timestamp is 31bits: | ||
| 1056 | + // An application could assume, for example, that all | ||
| 1057 | + // adjacent timestamps are within 2^31 milliseconds of each other, so | ||
| 1058 | + // 10000 comes after 4000000000, while 3000000000 comes before | ||
| 1059 | + // 4000000000. | ||
| 1060 | + // and flv specification says timestamp is 31bits: | ||
| 1061 | + // Extension of the Timestamp field to form a SI32 value. This | ||
| 1062 | + // field represents the upper 8 bits, while the previous | ||
| 1063 | + // Timestamp field represents the lower 24 bits of the time in | ||
| 1064 | + // milliseconds. | ||
| 1065 | + // in a word, 31bits timestamp is ok. | ||
| 1066 | + // convert extended timestamp to 31bits. | ||
| 1067 | + chunk->header.timestamp &= 0x7fffffff; | ||
| 1068 | + | ||
| 1055 | // valid message | 1069 | // valid message |
| 1056 | if (chunk->header.payload_length < 0) { | 1070 | if (chunk->header.payload_length < 0) { |
| 1057 | ret = ERROR_RTMP_MSG_INVLIAD_SIZE; | 1071 | ret = ERROR_RTMP_MSG_INVLIAD_SIZE; |
-
请 注册 或 登录 后发表评论