clear memory before usage in mcast

git-svn-id: svn://code.dyne.org/veejay/trunk@1325 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
Niels Elburg
2009-04-04 14:42:16 +00:00
parent 3a1e16e2f8
commit edd32fd86a
5 changed files with 15 additions and 9 deletions

View File

@@ -2552,10 +2552,10 @@ do_compress ( const lzo_bytep in , lzo_uint in_len,
ip += 4; ip += 4;
for (;;) for (;;)
{ {
register const lzo_bytep m_pos; register const lzo_bytep m_pos=0;
lzo_uint m_off; lzo_uint m_off=0;
lzo_uint m_len; lzo_uint m_len=0;
lzo_uint dindex; lzo_uint dindex=0;
DINDEX1(dindex,ip); DINDEX1(dindex,ip);
GINDEX(m_pos,m_off,dict,dindex,in); GINDEX(m_pos,m_off,dict,dindex,in);

View File

@@ -291,7 +291,7 @@ int net_thread_start(vj_client *v, vj_tag *tag)
if( tag->source_type == VJ_TAG_TYPE_MCAST ) if( tag->source_type == VJ_TAG_TYPE_MCAST )
{ {
char start_mcast[6]; char start_mcast[6];
sprintf(start_mcast, "%03d:;", VIMS_VIDEO_MCAST_START); snprintf(start_mcast,sizeof(start_mcast), "%03d:;", VIMS_VIDEO_MCAST_START);
veejay_msg(VEEJAY_MSG_DEBUG, "Request mcast stream from %s port %d", veejay_msg(VEEJAY_MSG_DEBUG, "Request mcast stream from %s port %d",
tag->source_name, tag->video_channel); tag->source_name, tag->video_channel);

View File

@@ -59,11 +59,11 @@ static void *mcast_packet_buffer_new( packet_header_t *header, frame_info_t *inf
#ifdef STRICT_CHECKING #ifdef STRICT_CHECKING
assert( header->length > 0 ); assert( header->length > 0 );
#endif #endif
packet_buffer_t *pb = (packet_buffer_t*) vj_malloc(sizeof(packet_buffer_t)); packet_buffer_t *pb = (packet_buffer_t*) vj_calloc(sizeof(packet_buffer_t));
veejay_memcpy( &(pb->hdr), header, sizeof(packet_header_t)); veejay_memcpy( &(pb->hdr), header, sizeof(packet_header_t));
veejay_memcpy( &(pb->inf), info, sizeof(frame_info_t)); veejay_memcpy( &(pb->inf), info, sizeof(frame_info_t));
pb->buf = vj_malloc( sizeof(uint8_t) * CHUNK_SIZE * header->length ); pb->buf = vj_calloc( sizeof(uint8_t) * CHUNK_SIZE * header->length );
pb->packets = vj_malloc( sizeof(uint16_t) * header->length ); pb->packets = vj_calloc( sizeof(uint16_t) * header->length );
veejay_memcpy( pb->buf + ( header->seq_num * CHUNK_SIZE), data + ( veejay_memcpy( pb->buf + ( header->seq_num * CHUNK_SIZE), data + (
sizeof(packet_header_t) + sizeof(frame_info_t)), CHUNK_SIZE ); sizeof(packet_header_t) + sizeof(frame_info_t)), CHUNK_SIZE );
#ifdef STRICT_CHECKING #ifdef STRICT_CHECKING
@@ -314,6 +314,7 @@ int mcast_recv_frame( mcast_receiver *v, uint8_t *linear_buf, int total_len, int
#endif #endif
packet_header_t hdr = packet_get_header( chunk ); packet_header_t hdr = packet_get_header( chunk );
frame_info_t inf; frame_info_t inf;
packet_get_info(&inf,chunk ); packet_get_info(&inf,chunk );
*dw = info.width; *dw = info.width;
*dh = info.height; *dh = info.height;

View File

@@ -183,6 +183,8 @@ int mcast_send_frame( mcast_sender *v, const VJFrame *frame,
uint8_t chunk[PACKET_PAYLOAD_SIZE]; uint8_t chunk[PACKET_PAYLOAD_SIZE];
int res = 0; int res = 0;
veejay_memset( chunk, 0,sizeof(chunk));
//@ If we can send in a single packet: //@ If we can send in a single packet:
if( total_len <= CHUNK_SIZE ) if( total_len <= CHUNK_SIZE )
{ {

View File

@@ -293,7 +293,10 @@ int vj_client_read_i( vj_client *v, uint8_t *dst, int len )
&p[0],&p[1],&p[2] ); &p[0],&p[1],&p[2] );
if(plen <= 0) if(plen <= 0)
return 0; return 0;
#ifdef STRICT_CHECKING
assert( p[0] > 0 );
assert( p[1] > 0 );
#endif
v->in_width = p[0]; v->in_width = p[0];
v->in_height = p[1]; v->in_height = p[1];
v->in_fmt = p[2]; v->in_fmt = p[2];