winlin

set audio/video flag to 0 in flv header.

@@ -143,8 +143,6 @@ off_t SrsFileStream::lseek(off_t offset) @@ -143,8 +143,6 @@ off_t SrsFileStream::lseek(off_t offset)
143 SrsFlvEncoder::SrsFlvEncoder() 143 SrsFlvEncoder::SrsFlvEncoder()
144 { 144 {
145 _fs = NULL; 145 _fs = NULL;
146 - has_audio = false;  
147 - has_video = false;  
148 tag_stream = new SrsStream(); 146 tag_stream = new SrsStream();
149 } 147 }
150 148
@@ -158,8 +156,6 @@ int SrsFlvEncoder::initialize(SrsFileStream* fs) @@ -158,8 +156,6 @@ int SrsFlvEncoder::initialize(SrsFileStream* fs)
158 int ret = ERROR_SUCCESS; 156 int ret = ERROR_SUCCESS;
159 157
160 _fs = fs; 158 _fs = fs;
161 - has_audio = true;  
162 - has_video = true;  
163 159
164 return ret; 160 return ret;
165 } 161 }
@@ -179,16 +175,9 @@ int SrsFlvEncoder::write_header() @@ -179,16 +175,9 @@ int SrsFlvEncoder::write_header()
179 (char)0x00, (char)0x00, (char)0x00, (char)0x00// PreviousTagSize0 UI32 Always 0 175 (char)0x00, (char)0x00, (char)0x00, (char)0x00// PreviousTagSize0 UI32 Always 0
180 }; 176 };
181 177
182 - // generate audio/video flag.  
183 - const static int av_index = 4;  
184 -  
185 - flv_header[av_index] = 0x00;  
186 - if (has_audio) {  
187 - flv_header[av_index] += 4;  
188 - }  
189 - if (has_video) {  
190 - flv_header[av_index] += 1;  
191 - } 178 + // flv specification should set the audio and video flag,
  179 + // actually in practise, application generally ignore this flag,
  180 + // so we generally set the audio/video to 0.
192 181
193 // write data. 182 // write data.
194 if ((ret = _fs->write(flv_header, sizeof(flv_header), NULL)) != ERROR_SUCCESS) { 183 if ((ret = _fs->write(flv_header, sizeof(flv_header), NULL)) != ERROR_SUCCESS) {
@@ -229,8 +218,6 @@ int SrsFlvEncoder::write_audio(int32_t timestamp, char* data, int size) @@ -229,8 +218,6 @@ int SrsFlvEncoder::write_audio(int32_t timestamp, char* data, int size)
229 { 218 {
230 int ret = ERROR_SUCCESS; 219 int ret = ERROR_SUCCESS;
231 220
232 - has_audio = true;  
233 -  
234 static char tag_header[] = { 221 static char tag_header[] = {
235 (char)8, // TagType UB [5], 8 = audio 222 (char)8, // TagType UB [5], 8 = audio
236 (char)0x00, (char)0x00, (char)0x00, // DataSize UI24 Length of the message. 223 (char)0x00, (char)0x00, (char)0x00, // DataSize UI24 Length of the message.
@@ -260,8 +247,6 @@ int SrsFlvEncoder::write_video(int32_t timestamp, char* data, int size) @@ -260,8 +247,6 @@ int SrsFlvEncoder::write_video(int32_t timestamp, char* data, int size)
260 { 247 {
261 int ret = ERROR_SUCCESS; 248 int ret = ERROR_SUCCESS;
262 249
263 - has_video = true;  
264 -  
265 static char tag_header[] = { 250 static char tag_header[] = {
266 (char)9, // TagType UB [5], 9 = video 251 (char)9, // TagType UB [5], 9 = video
267 (char)0x00, (char)0x00, (char)0x00, // DataSize UI24 Length of the message. 252 (char)0x00, (char)0x00, (char)0x00, // DataSize UI24 Length of the message.
@@ -79,8 +79,6 @@ class SrsFlvEncoder @@ -79,8 +79,6 @@ class SrsFlvEncoder
79 private: 79 private:
80 SrsFileStream* _fs; 80 SrsFileStream* _fs;
81 private: 81 private:
82 - bool has_audio;  
83 - bool has_video;  
84 SrsStream* tag_stream; 82 SrsStream* tag_stream;
85 public: 83 public:
86 SrsFlvEncoder(); 84 SrsFlvEncoder();