Revision bd209760 chunker_streamer.c

View differences:

chunker_streamer.c
335 335
		fprintf(stderr, "INIT: Memory error alloc Frame!!!\n");
336 336
		return -1;
337 337
	}
338
	sizeFrame = 3*sizeof(int)+sizeof(struct timeval);
338
	sizeFrame = 3*sizeof(int32_t)+sizeof(struct timeval);
339 339
	chunk = (ExternalChunk *)malloc(sizeof(ExternalChunk));
340 340
	if(!chunk) {
341 341
		fprintf(stderr, "INIT: Memory error alloc chunk!!!\n");
342 342
		return -1;
343 343
	}
344
	sizeChunk = 6*sizeof(int)+2*sizeof(struct timeval)+sizeof(double);
344
	sizeChunk = 6*sizeof(int32_t)+2*sizeof(struct timeval)+sizeof(double);
345 345
    chunk->data=NULL;
346 346
	initChunk(chunk, &seq_current_chunk);
347 347
	chunkaudio = (ExternalChunk *)malloc(sizeof(ExternalChunk));
......
350 350
		return -1;
351 351
	}
352 352
    chunkaudio->data=NULL;
353
	initChunk(chunkaudio, &seq_current_chunk);
353
	initChunk(chunkaudio, &seq_current_chunk+1);
354 354
	
355 355
	//av_init_packet(&packet);
356 356

  
......
484 484
#endif
485 485

  
486 486
					tempdata = chunk->data+chunk->payload_len;
487
					*((int *)tempdata) = frame->number;
488
					tempdata+=sizeof(int);
487
					*((int32_t *)tempdata) = frame->number;
488
					tempdata+=sizeof(int32_t);
489 489
					*((struct timeval *)tempdata) = frame->timestamp;
490 490
					tempdata+=sizeof(struct timeval);
491
					*((int *)tempdata) = frame->size;
492
					tempdata+=sizeof(int);
493
					*((int *)tempdata) = frame->type;
494
					tempdata+=sizeof(int);
491
					*((int32_t *)tempdata) = frame->size;
492
					tempdata+=sizeof(int32_t);
493
					*((int32_t *)tempdata) = frame->type;
494
					tempdata+=sizeof(int32_t);
495 495
					
496 496
					memcpy(chunk->data+chunk->payload_len+sizeFrame,outbuf,out_size); // insert new data
497 497
					chunk->payload_len += out_size + sizeFrame; // update payload length
......
642 642
				chunkaudio->frames_num++; // number of frames in the current chunk
643 643
				contFrameAudio++;
644 644
				tempdata = chunkaudio->data+chunkaudio->payload_len;
645
				*((int *)tempdata) = frame->number;
646
				tempdata+=sizeof(int);
645
				*((int32_t *)tempdata) = frame->number;
646
				tempdata+=sizeof(int32_t);
647 647
				*((struct timeval *)tempdata) = frame->timestamp;
648 648
				tempdata+=sizeof(struct timeval);
649
				*((int *)tempdata) = frame->size;
650
				tempdata+=sizeof(int);
651
				*((int *)tempdata) = frame->type;
652
				tempdata+=sizeof(int);
649
				*((int32_t *)tempdata) = frame->size;
650
				tempdata+=sizeof(int32_t);
651
				*((int32_t *)tempdata) = frame->type;
652
				tempdata+=sizeof(int32_t);
653 653
					
654 654
				memcpy(chunkaudio->data+chunkaudio->payload_len+sizeFrame,outbuf_audio,audio_size);
655 655
				chunkaudio->payload_len += audio_size + sizeFrame; // update payload length
......
673 673
					//saveChunkOnFile(chunkaudio);
674 674
					//Send the chunk via http to an external transport/player
675 675
					pushChunkHttp(chunkaudio, cmeta->outside_world_url);
676
					initChunk(chunkaudio, &seq_current_chunk);
676
					initChunk(chunkaudio, &seq_current_chunk+1);
677 677
				}
678 678
			}
679 679
		}

Also available in: Unified diff