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

pull/133/head
winlin 10 years ago
parent 0ff49fd299
commit 5c3c38684b

@ -1,3 +1,3 @@
#ifndef _srs_upp_icpp_init_stub #ifndef _ide_srs_upp_icpp_init_stub
#define _srs_upp_icpp_init_stub #define _ide_srs_upp_icpp_init_stub
#endif #endif

@ -394,7 +394,7 @@ int SrsFlvStreamEncoder::write_video(int64_t timestamp, char* data, int size)
int SrsFlvStreamEncoder::write_metadata(int64_t timestamp, char* data, int size) int SrsFlvStreamEncoder::write_metadata(int64_t timestamp, char* data, int size)
{ {
return enc->write_metadata(timestamp, data, size); return enc->write_metadata(SrsCodecFlvTagScript, data, size);
} }
bool SrsFlvStreamEncoder::has_cache() bool SrsFlvStreamEncoder::has_cache()

@ -36,6 +36,7 @@ using namespace std;
#include <srs_kernel_error.hpp> #include <srs_kernel_error.hpp>
#include <srs_kernel_stream.hpp> #include <srs_kernel_stream.hpp>
#include <srs_kernel_file.hpp> #include <srs_kernel_file.hpp>
#include <srs_kernel_codec.hpp>
#define SRS_FLV_TAG_HEADER_SIZE 11 #define SRS_FLV_TAG_HEADER_SIZE 11
#define SRS_FLV_PREVIOUS_TAG_SIZE 4 #define SRS_FLV_PREVIOUS_TAG_SIZE 4
@ -149,7 +150,7 @@ int SrsFlvEncoder::write_audio(int64_t timestamp, char* data, int size)
// 11bytes tag header // 11bytes tag header
static char tag_header[] = { static char tag_header[] = {
(char)8, // TagType UB [5], 8 = audio (char)SrsCodecFlvTagAudio, // TagType UB [5], 8 = audio
(char)0x00, (char)0x00, (char)0x00, // DataSize UI24 Length of the message. (char)0x00, (char)0x00, (char)0x00, // DataSize UI24 Length of the message.
(char)0x00, (char)0x00, (char)0x00, // Timestamp UI24 Time in milliseconds at which the data in this tag applies. (char)0x00, (char)0x00, (char)0x00, // Timestamp UI24 Time in milliseconds at which the data in this tag applies.
(char)0x00, // TimestampExtended UI8 (char)0x00, // TimestampExtended UI8
@ -183,7 +184,7 @@ int SrsFlvEncoder::write_video(int64_t timestamp, char* data, int size)
// 11bytes tag header // 11bytes tag header
static char tag_header[] = { static char tag_header[] = {
(char)9, // TagType UB [5], 9 = video (char)SrsCodecFlvTagVideo, // TagType UB [5], 9 = video
(char)0x00, (char)0x00, (char)0x00, // DataSize UI24 Length of the message. (char)0x00, (char)0x00, (char)0x00, // DataSize UI24 Length of the message.
(char)0x00, (char)0x00, (char)0x00, // Timestamp UI24 Time in milliseconds at which the data in this tag applies. (char)0x00, (char)0x00, (char)0x00, // Timestamp UI24 Time in milliseconds at which the data in this tag applies.
(char)0x00, // TimestampExtended UI8 (char)0x00, // TimestampExtended UI8

@ -67,6 +67,7 @@ public:
/** /**
* write flv metadata. * write flv metadata.
* @param type, the type of data, or other message type. * @param type, the type of data, or other message type.
* @see SrsCodecFlvTag
* @param data, the amf0 metadata which serialize from: * @param data, the amf0 metadata which serialize from:
* AMF0 string: onMetaData, * AMF0 string: onMetaData,
* AMF0 object: the metadata object. * AMF0 object: the metadata object.

Loading…
Cancel
Save