winlin

fix #302, remove the thread unsafe code, no static.

@@ -146,7 +146,7 @@ public: @@ -146,7 +146,7 @@ public:
146 data.append(serialFlv(msg)); 146 data.append(serialFlv(msg));
147 } 147 }
148 148
149 - static char box_header[8]; 149 + char box_header[8];
150 SrsStream ss; 150 SrsStream ss;
151 ss.initialize(box_header, 8); 151 ss.initialize(box_header, 8);
152 ss.write_4bytes(8 + data.size()); 152 ss.write_4bytes(8 + data.size());
@@ -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 146 34 +#define VERSION_REVISION 147
35 35
36 // server info. 36 // server info.
37 #define RTMP_SIG_SRS_KEY "SRS" 37 #define RTMP_SIG_SRS_KEY "SRS"
@@ -74,7 +74,7 @@ int SrsFlvEncoder::write_header() @@ -74,7 +74,7 @@ int SrsFlvEncoder::write_header()
74 int ret = ERROR_SUCCESS; 74 int ret = ERROR_SUCCESS;
75 75
76 // 9bytes header and 4bytes first previous-tag-size 76 // 9bytes header and 4bytes first previous-tag-size
77 - static char flv_header[] = { 77 + char flv_header[] = {
78 'F', 'L', 'V', // Signatures "FLV" 78 'F', 'L', 'V', // Signatures "FLV"
79 (char)0x01, // File version (for example, 0x01 for FLV version 1) 79 (char)0x01, // File version (for example, 0x01 for FLV version 1)
80 (char)0x00, // 4, audio; 1, video; 5 audio+video. 80 (char)0x00, // 4, audio; 1, video; 5 audio+video.
@@ -118,7 +118,7 @@ int SrsFlvEncoder::write_metadata(char type, char* data, int size) @@ -118,7 +118,7 @@ int SrsFlvEncoder::write_metadata(char type, char* data, int size)
118 srs_assert(data); 118 srs_assert(data);
119 119
120 // 11 bytes tag header 120 // 11 bytes tag header
121 - static char tag_header[] = { 121 + char tag_header[] = {
122 (char)type, // TagType UB [5], 18 = script data 122 (char)type, // TagType UB [5], 18 = script data
123 (char)0x00, (char)0x00, (char)0x00, // DataSize UI24 Length of the message. 123 (char)0x00, (char)0x00, (char)0x00, // DataSize UI24 Length of the message.
124 (char)0x00, (char)0x00, (char)0x00, // Timestamp UI24 Time in milliseconds at which the data in this tag applies. 124 (char)0x00, (char)0x00, (char)0x00, // Timestamp UI24 Time in milliseconds at which the data in this tag applies.
@@ -149,7 +149,7 @@ int SrsFlvEncoder::write_audio(int64_t timestamp, char* data, int size) @@ -149,7 +149,7 @@ int SrsFlvEncoder::write_audio(int64_t timestamp, char* data, int size)
149 timestamp &= 0x7fffffff; 149 timestamp &= 0x7fffffff;
150 150
151 // 11bytes tag header 151 // 11bytes tag header
152 - static char tag_header[] = { 152 + char tag_header[] = {
153 (char)SrsCodecFlvTagAudio, // TagType UB [5], 8 = audio 153 (char)SrsCodecFlvTagAudio, // TagType UB [5], 8 = audio
154 (char)0x00, (char)0x00, (char)0x00, // DataSize UI24 Length of the message. 154 (char)0x00, (char)0x00, (char)0x00, // DataSize UI24 Length of the message.
155 (char)0x00, (char)0x00, (char)0x00, // Timestamp UI24 Time in milliseconds at which the data in this tag applies. 155 (char)0x00, (char)0x00, (char)0x00, // Timestamp UI24 Time in milliseconds at which the data in this tag applies.
@@ -183,7 +183,7 @@ int SrsFlvEncoder::write_video(int64_t timestamp, char* data, int size) @@ -183,7 +183,7 @@ int SrsFlvEncoder::write_video(int64_t timestamp, char* data, int size)
183 timestamp &= 0x7fffffff; 183 timestamp &= 0x7fffffff;
184 184
185 // 11bytes tag header 185 // 11bytes tag header
186 - static char tag_header[] = { 186 + char tag_header[] = {
187 (char)SrsCodecFlvTagVideo, // TagType UB [5], 9 = video 187 (char)SrsCodecFlvTagVideo, // TagType UB [5], 9 = video
188 (char)0x00, (char)0x00, (char)0x00, // DataSize UI24 Length of the message. 188 (char)0x00, (char)0x00, (char)0x00, // DataSize UI24 Length of the message.
189 (char)0x00, (char)0x00, (char)0x00, // Timestamp UI24 Time in milliseconds at which the data in this tag applies. 189 (char)0x00, (char)0x00, (char)0x00, // Timestamp UI24 Time in milliseconds at which the data in this tag applies.
@@ -231,7 +231,7 @@ int SrsFlvEncoder::write_tag(char* header, int header_size, char* tag, int tag_s @@ -231,7 +231,7 @@ int SrsFlvEncoder::write_tag(char* header, int header_size, char* tag, int tag_s
231 } 231 }
232 232
233 // PreviousTagSizeN UI32 Size of last tag, including its header, in bytes. 233 // PreviousTagSizeN UI32 Size of last tag, including its header, in bytes.
234 - static char pre_size[SRS_FLV_PREVIOUS_TAG_SIZE]; 234 + char pre_size[SRS_FLV_PREVIOUS_TAG_SIZE];
235 if ((ret = tag_stream->initialize(pre_size, SRS_FLV_PREVIOUS_TAG_SIZE)) != ERROR_SUCCESS) { 235 if ((ret = tag_stream->initialize(pre_size, SRS_FLV_PREVIOUS_TAG_SIZE)) != ERROR_SUCCESS) {
236 return ret; 236 return ret;
237 } 237 }
@@ -426,7 +426,7 @@ int SrsFlvVodStreamDecoder::read_sequence_header_summary(int64_t* pstart, int* p @@ -426,7 +426,7 @@ int SrsFlvVodStreamDecoder::read_sequence_header_summary(int64_t* pstart, int* p
426 // and must be a sequence video and audio. 426 // and must be a sequence video and audio.
427 427
428 // 11bytes tag header 428 // 11bytes tag header
429 - static char tag_header[] = { 429 + char tag_header[] = {
430 (char)0x00, // TagType UB [5], 9 = video, 8 = audio, 18 = script data 430 (char)0x00, // TagType UB [5], 9 = video, 8 = audio, 18 = script data
431 (char)0x00, (char)0x00, (char)0x00, // DataSize UI24 Length of the message. 431 (char)0x00, (char)0x00, (char)0x00, // DataSize UI24 Length of the message.
432 (char)0x00, (char)0x00, (char)0x00, // Timestamp UI24 Time in milliseconds at which the data in this tag applies. 432 (char)0x00, (char)0x00, (char)0x00, // Timestamp UI24 Time in milliseconds at which the data in this tag applies.
@@ -68,7 +68,7 @@ int SrsMp3Encoder::initialize(SrsFileWriter* fs) @@ -68,7 +68,7 @@ int SrsMp3Encoder::initialize(SrsFileWriter* fs)
68 68
69 int SrsMp3Encoder::write_header() 69 int SrsMp3Encoder::write_header()
70 { 70 {
71 - static char id3[] = { 71 + char id3[] = {
72 (char)0x49, (char)0x44, (char)0x33, // ID3 72 (char)0x49, (char)0x44, (char)0x33, // ID3
73 (char)0x03, (char)0x00, // version 73 (char)0x03, (char)0x00, // version
74 (char)0x00, // flags 74 (char)0x00, // flags
@@ -2772,7 +2772,7 @@ int SrsTsCache::do_cache_aac(SrsAvcAacCodec* codec, SrsCodecSample* sample) @@ -2772,7 +2772,7 @@ int SrsTsCache::do_cache_aac(SrsAvcAacCodec* codec, SrsCodecSample* sample)
2772 // 6.2 Audio Data Transport Stream, ADTS 2772 // 6.2 Audio Data Transport Stream, ADTS
2773 // in aac-iso-13818-7.pdf, page 26. 2773 // in aac-iso-13818-7.pdf, page 26.
2774 // fixed 7bytes header 2774 // fixed 7bytes header
2775 - static u_int8_t adts_header[7] = {0xff, 0xf9, 0x00, 0x00, 0x00, 0x0f, 0xfc}; 2775 + u_int8_t adts_header[7] = {0xff, 0xf9, 0x00, 0x00, 0x00, 0x0f, 0xfc};
2776 /* 2776 /*
2777 // adts_fixed_header 2777 // adts_fixed_header
2778 // 2B, 16bits 2778 // 2B, 16bits
@@ -2824,7 +2824,7 @@ int SrsTsCache::do_cache_avc(SrsAvcAacCodec* codec, SrsCodecSample* sample) @@ -2824,7 +2824,7 @@ int SrsTsCache::do_cache_avc(SrsAvcAacCodec* codec, SrsCodecSample* sample)
2824 int ret = ERROR_SUCCESS; 2824 int ret = ERROR_SUCCESS;
2825 2825
2826 // for type1/5/6, insert aud packet. 2826 // for type1/5/6, insert aud packet.
2827 - static u_int8_t aud_nal[] = { 0x00, 0x00, 0x00, 0x01, 0x09, 0xf0 }; 2827 + u_int8_t aud_nal[] = { 0x00, 0x00, 0x00, 0x01, 0x09, 0xf0 };
2828 2828
2829 bool sps_pps_sent = false; 2829 bool sps_pps_sent = false;
2830 bool aud_sent = false; 2830 bool aud_sent = false;
@@ -2340,7 +2340,7 @@ int srs_human_print_rtmp_packet(char type, u_int32_t timestamp, char* data, int @@ -2340,7 +2340,7 @@ int srs_human_print_rtmp_packet(char type, u_int32_t timestamp, char* data, int
2340 const char* srs_human_format_time() 2340 const char* srs_human_format_time()
2341 { 2341 {
2342 struct timeval tv; 2342 struct timeval tv;
2343 - static char buf[23]; 2343 + char buf[23];
2344 2344
2345 memset(buf, 0, sizeof(buf)); 2345 memset(buf, 0, sizeof(buf));
2346 2346
@@ -260,7 +260,7 @@ int SrsHandshakeBytes::create_c0c1() @@ -260,7 +260,7 @@ int SrsHandshakeBytes::create_c0c1()
260 srs_random_generate(c0c1, 1537); 260 srs_random_generate(c0c1, 1537);
261 261
262 // plain text required. 262 // plain text required.
263 - static SrsStream stream; 263 + SrsStream stream;
264 if ((ret = stream.initialize(c0c1, 9)) != ERROR_SUCCESS) { 264 if ((ret = stream.initialize(c0c1, 9)) != ERROR_SUCCESS) {
265 return ret; 265 return ret;
266 } 266 }