not giving c stuff go pointers

This commit is contained in:
Saxon1 2018-05-05 23:58:26 +09:30
parent 88c2104048
commit e6aefb2e65
1 changed files with 4 additions and 0 deletions

View File

@ -65,12 +65,16 @@ unsigned int RTMP_start_session(char* url, uint connect_timeout){
} }
unsigned int RTMP_write_frame(char* data, uint data_length){ unsigned int RTMP_write_frame(char* data, uint data_length){
dataForC = malloc(data_length);
memcpy(dataForC,data,data_length);
if (!RTMP_IsConnected(rtmp)) { if (!RTMP_IsConnected(rtmp)) {
printf("RTMP is not connected!\n"); printf("RTMP is not connected!\n");
free(dataForC);
return 0; return 0;
} }
if (!RTMP_Write(rtmp, (const char*)data, data_length)) { if (!RTMP_Write(rtmp, (const char*)data, data_length)) {
printf("RTMP write error!\n"); printf("RTMP write error!\n");
free(dataForC);
return 0; return 0;
} }
return 1; return 1;