Commit 25cbae45 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

RTMP: factorization

parent 2a960712
...@@ -407,19 +407,15 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len ) ...@@ -407,19 +407,15 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
tmp_buffer = rtmp_encode_packet( p_sys->p_thread, rtmp_packet ); tmp_buffer = rtmp_encode_packet( p_sys->p_thread, rtmp_packet );
i_ret = net_Write( p_sys->p_thread, p_sys->p_thread->fd, NULL, tmp_buffer, rtmp_packet->length_encoded ); i_ret = net_Write( p_sys->p_thread, p_sys->p_thread->fd, NULL, tmp_buffer, rtmp_packet->length_encoded );
free( rtmp_packet->body->body );
free( rtmp_packet->body );
free( rtmp_packet );
free( tmp_buffer );
if( i_ret != rtmp_packet->length_encoded ) if( i_ret != rtmp_packet->length_encoded )
{ {
free( rtmp_packet->body->body );
free( rtmp_packet->body );
free( rtmp_packet );
free( tmp_buffer );
msg_Err( p_access, "failed send publish start" ); msg_Err( p_access, "failed send publish start" );
return -1; return -1;
} }
free( rtmp_packet->body->body );
free( rtmp_packet->body );
free( rtmp_packet );
free( tmp_buffer );
} }
p_access->info.i_pos += i_len_tmp; p_access->info.i_pos += i_len_tmp;
...@@ -429,19 +425,16 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len ) ...@@ -429,19 +425,16 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
tmp_buffer = rtmp_encode_packet( p_sys->p_thread, rtmp_packet ); tmp_buffer = rtmp_encode_packet( p_sys->p_thread, rtmp_packet );
i_ret = net_Write( p_sys->p_thread, p_sys->p_thread->fd, NULL, tmp_buffer, rtmp_packet->length_encoded ); i_ret = net_Write( p_sys->p_thread, p_sys->p_thread->fd, NULL, tmp_buffer, rtmp_packet->length_encoded );
free( rtmp_packet->body->body );
free( rtmp_packet->body );
free( rtmp_packet );
free( tmp_buffer );
if( i_ret != rtmp_packet->length_encoded ) if( i_ret != rtmp_packet->length_encoded )
{ {
free( rtmp_packet->body->body );
free( rtmp_packet->body );
free( rtmp_packet );
free( tmp_buffer );
msg_Err( p_access, "failed send bytes read" ); msg_Err( p_access, "failed send bytes read" );
return -1; return -1;
} }
free( rtmp_packet->body->body );
free( rtmp_packet->body );
free( rtmp_packet );
free( tmp_buffer );
} }
return i_len_tmp; return i_len_tmp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment