Revision 9adf384d chunker_streamer/chunk_pusher.c

View differences:

chunker_streamer/chunk_pusher.c
13 13

  
14 14

  
15 15
int pushChunkHttp(ExternalChunk *echunk, char *url) {
16

  
16 17
	Chunk gchunk;
17 18
	void *grapes_chunk_attributes_block = NULL;
18
	int ts1e3 = 0.0;
19
	int tus3e1 = 0.0;
20 19
	int ret = STREAMER_FAIL_RETURN;
21 20
	//we need to pack 5 int32s + 2 timeval structs + 1 double
22 21
	static size_t ExternalChunk_header_size = 5*CHUNK_TRANSCODING_INT_SIZE + 2*CHUNK_TRANSCODING_INT_SIZE + 2*CHUNK_TRANSCODING_INT_SIZE + 1*CHUNK_TRANSCODING_INT_SIZE*2;
......
26 25

  
27 26
	/* first pack the chunk info that we get from the streamer into an "attributes" block of a regular GRAPES chunk */
28 27
	if(	(grapes_chunk_attributes_block = packExternalChunkToAttributes(echunk, ExternalChunk_header_size)) != NULL ) {
28
		struct timeval now;
29

  
29 30
		/* then fill-up a proper GRAPES chunk */
30 31
		gchunk.size = echunk->payload_len;
31
		/* convert external_chunk start_time in milliseconds and put it in grapes chunk */
32
		ts1e3 = (int)(echunk->start_time.tv_sec*1e3);
33
		//tus3e1 = (int)(echunk->start_time.tv_usec/1e3); ALREADY IN MILLI SECONDS
34
		gchunk.timestamp = ts1e3+(int)(echunk->start_time.tv_usec);
35
#ifdef DEBUG_PUSHER
36
			fprintf(stderr, "PUSHER: start sec %d usec %d timestamp %ld\n", ts1e3, (int)(echunk->start_time.tv_usec), gchunk.timestamp);
37
#endif
32
		/* then fill the timestamp */
33
		gettimeofday(&now, NULL);
34
		gchunk.timestamp = now.tv_sec * 1000000ULL + now.tv_usec;
38 35

  
39 36
		//decide how to create the chunk ID
40 37
		if(cmeta->cid == 0) {

Also available in: Unified diff