Merged in kortschak/av/cgo/nocopy (pull request #20)

rtmp: remove unused allocation and copy
This commit is contained in:
kortschak 2018-06-01 15:02:49 +00:00 committed by Alan Noble
commit 219971230c
1 changed files with 0 additions and 6 deletions

View File

@ -65,22 +65,16 @@ RTMP* start_session(RTMP* rtmp, char* url, uint connect_timeout) {
} }
unsigned int write_frame(RTMP* rtmp, char* data, uint data_length) { unsigned int write_frame(RTMP* rtmp, char* data, uint data_length) {
char* 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 1; return 1;
} }
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 1; return 1;
} }
free(dataForC);
return 0; return 0;
} }