Revision 7e4b3a0c

View differences:

chunker_player/player_core.c
167 167
#endif
168 168
	}
169 169
*/
170
	// minus one means no lost frames estimation
170
	// minus one means no lost frames estimation, useless during QueuePut operations
171 171
	UpdateQueueStats(q, -1);
172 172

  
173 173
	SDL_UnlockMutex(q->mutex);
......
381 381
	if(q->last_pkt == NULL)
382 382
		return;
383 383
	
384
	if(q->last_pkt->pkt.stream_index > q->first_pkt->pkt.stream_index)
384
	if(q->last_pkt->pkt.stream_index >= q->first_pkt->pkt.stream_index)
385 385
	{
386
		q->density = (double)q->nb_packets / (double)(q->last_pkt->pkt.stream_index - q->first_pkt->pkt.stream_index) * 100.0;
386
		q->density = (double)q->nb_packets / (double)(q->last_pkt->pkt.stream_index - q->first_pkt->pkt.stream_index + 1) * 100.0; //plus 1 because if they are adjacent (difference 1) there really should be 2 packets in the queue
387 387
	}
388 388
	
389 389
#ifdef DEBUG_STATS
390 390
	if(q->queueType == AUDIO)
391
		printf("STATS: AUDIO QUEUE DENSITY percentage %f\n", q->density);
391
		printf("STATS: AUDIO QUEUE DENSITY percentage %f, last %d, first %d, pkts %d\n", q->density, q->last_pkt->pkt.stream_index, q->first_pkt->pkt.stream_index, q->nb_packets);
392 392
	if(q->queueType == VIDEO)
393
		printf("STATS: VIDEO QUEUE DENSITY percentage %f\n", q->density);
393
		printf("STATS: VIDEO QUEUE DENSITY percentage %f, last %d, first %d, pkts %d\n", q->density, q->last_pkt->pkt.stream_index, q->first_pkt->pkt.stream_index, q->nb_packets);
394 394
#endif
395 395
	
396 396
	if(!last_print)
......
437 437
		char stats[255];
438 438
		if(q->queueType == AUDIO)
439 439
		{
440
			sprintf(stats, "[AUDIO] queue density: %d --- lost_frames/sec: %d --- total_lost_frames: %d", (int)q->density, q->instant_lost_frames, q->total_lost_frames);
440
			sprintf(stats, "[AUDIO] queue density: %d\%% --- lost_frames/sec: %d --- total_lost_frames: %d", (int)q->density, q->instant_lost_frames, q->total_lost_frames);
441 441
			ChunkerPlayerGUI_SetStatsText(stats, NULL);
442 442
		}
443 443
		else if(q->queueType == VIDEO)
444 444
		{
445
			sprintf(stats, "[VIDEO] queue density: %d --- lost_frames/sec: %d --- total_lost_frames: %d", (int)q->density, q->instant_lost_frames, q->total_lost_frames);
445
			sprintf(stats, "[VIDEO] queue density: %d%% --- lost_frames/sec: %d --- total_lost_frames: %d", (int)q->density, q->instant_lost_frames, q->total_lost_frames);
446 446
			ChunkerPlayerGUI_SetStatsText(NULL, stats);
447 447
		}
448 448
		
......
774 774
	pCodecCtx->codec_id  = CODEC_ID_H264;
775 775
	pCodecCtx->me_range = 16;
776 776
	pCodecCtx->max_qdiff = 4;
777
	pCodecCtx->qmin = 10;
778
	pCodecCtx->qmax = 51;
777
	pCodecCtx->qmin = 1;
778
	pCodecCtx->qmax = 30;
779 779
	pCodecCtx->qcompress = 0.6;
780 780
#else
781 781
	pCodecCtx->codec_id  = CODEC_ID_MPEG4;

Also available in: Unified diff