winlin

fix the bug of flv stream, metadata type should be 18

1 -#ifndef _srs_upp_icpp_init_stub  
2 -#define _srs_upp_icpp_init_stub 1 +#ifndef _ide_srs_upp_icpp_init_stub
  2 +#define _ide_srs_upp_icpp_init_stub
3 #endif 3 #endif
@@ -394,7 +394,7 @@ int SrsFlvStreamEncoder::write_video(int64_t timestamp, char* data, int size) @@ -394,7 +394,7 @@ int SrsFlvStreamEncoder::write_video(int64_t timestamp, char* data, int size)
394 394
395 int SrsFlvStreamEncoder::write_metadata(int64_t timestamp, char* data, int size) 395 int SrsFlvStreamEncoder::write_metadata(int64_t timestamp, char* data, int size)
396 { 396 {
397 - return enc->write_metadata(timestamp, data, size); 397 + return enc->write_metadata(SrsCodecFlvTagScript, data, size);
398 } 398 }
399 399
400 bool SrsFlvStreamEncoder::has_cache() 400 bool SrsFlvStreamEncoder::has_cache()
@@ -36,6 +36,7 @@ using namespace std; @@ -36,6 +36,7 @@ using namespace std;
36 #include <srs_kernel_error.hpp> 36 #include <srs_kernel_error.hpp>
37 #include <srs_kernel_stream.hpp> 37 #include <srs_kernel_stream.hpp>
38 #include <srs_kernel_file.hpp> 38 #include <srs_kernel_file.hpp>
  39 +#include <srs_kernel_codec.hpp>
39 40
40 #define SRS_FLV_TAG_HEADER_SIZE 11 41 #define SRS_FLV_TAG_HEADER_SIZE 11
41 #define SRS_FLV_PREVIOUS_TAG_SIZE 4 42 #define SRS_FLV_PREVIOUS_TAG_SIZE 4
@@ -149,7 +150,7 @@ int SrsFlvEncoder::write_audio(int64_t timestamp, char* data, int size) @@ -149,7 +150,7 @@ int SrsFlvEncoder::write_audio(int64_t timestamp, char* data, int size)
149 150
150 // 11bytes tag header 151 // 11bytes tag header
151 static char tag_header[] = { 152 static char tag_header[] = {
152 - (char)8, // TagType UB [5], 8 = audio 153 + (char)SrsCodecFlvTagAudio, // TagType UB [5], 8 = audio
153 (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.
154 (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.
155 (char)0x00, // TimestampExtended UI8 156 (char)0x00, // TimestampExtended UI8
@@ -183,7 +184,7 @@ int SrsFlvEncoder::write_video(int64_t timestamp, char* data, int size) @@ -183,7 +184,7 @@ int SrsFlvEncoder::write_video(int64_t timestamp, char* data, int size)
183 184
184 // 11bytes tag header 185 // 11bytes tag header
185 static char tag_header[] = { 186 static char tag_header[] = {
186 - (char)9, // TagType UB [5], 9 = video 187 + (char)SrsCodecFlvTagVideo, // TagType UB [5], 9 = video
187 (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.
188 (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.
189 (char)0x00, // TimestampExtended UI8 190 (char)0x00, // TimestampExtended UI8
@@ -67,6 +67,7 @@ public: @@ -67,6 +67,7 @@ public:
67 /** 67 /**
68 * write flv metadata. 68 * write flv metadata.
69 * @param type, the type of data, or other message type. 69 * @param type, the type of data, or other message type.
  70 + * @see SrsCodecFlvTag
70 * @param data, the amf0 metadata which serialize from: 71 * @param data, the amf0 metadata which serialize from:
71 * AMF0 string: onMetaData, 72 * AMF0 string: onMetaData,
72 * AMF0 object: the metadata object. 73 * AMF0 object: the metadata object.