1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

fix bug of ingest for android, init the variable to 0

This commit is contained in:
winlin 2014-04-19 12:49:05 +08:00
parent c530a8e5fc
commit 5c8aad4fe4

24
trunk/research/librtmp/srs_ingest_flv.c Normal file → Executable file
View file

@ -229,7 +229,7 @@ int flv_read_packet(int flv_fd, int* type, u_int32_t* timestamp, char** data, in
char th[11]; // tag header char th[11]; // tag header
char ts[4]; // tag size char ts[4]; // tag size
u_int32_t data_size = 0; int32_t data_size = 0;
u_int32_t time = 0; u_int32_t time = 0;
char* pp; char* pp;
@ -263,16 +263,20 @@ int flv_read_packet(int flv_fd, int* type, u_int32_t* timestamp, char** data, in
*timestamp = time; *timestamp = time;
if (data_size > 0) { // check data size.
*size = data_size; if (data_size <= 0) {
*data = (char*)malloc(data_size); ret = -1;
trace("invalid data size. size=%d, ret=%d", data_size, ret);
return ret;
}
// read tag data // read tag data.
if (read(flv_fd, *data, data_size) != data_size) { *size = data_size;
ret = -1; *data = (char*)malloc(data_size);
trace("read flv tag data failed. size=%d, ret=%d", data_size, ret); if (read(flv_fd, *data, data_size) != data_size) {
return ret; ret = -1;
} trace("read flv tag data failed. size=%d, ret=%d", data_size, ret);
return ret;
} }
// ignore 4bytes tag size. // ignore 4bytes tag size.