comparison src/recpt1.c @ 127:5a380559a61e

modify calclate bitrate mechanism.
author Naoya OYAMA <naoya.oyama@gmail.com>
date Tue, 05 Oct 2010 01:42:59 +0900
parents 5dcaf3785ebe
children 0db6ccf0fe31
comparison
equal deleted inserted replaced
126:5dcaf3785ebe 127:5a380559a61e
669 thread_data *data = (thread_data *)p; 669 thread_data *data = (thread_data *)p;
670 STREAM_QUEUE_T *p_queue = data->stream_queue; 670 STREAM_QUEUE_T *p_queue = data->stream_queue;
671 ARIB_STD_B25_BUFFER *qbuf = NULL; 671 ARIB_STD_B25_BUFFER *qbuf = NULL;
672 ARIB_STD_B25_BUFFER *buf; 672 ARIB_STD_B25_BUFFER *buf;
673 int i; 673 int i;
674 clock_gettime(CLOCK_REALTIME, &data->streamer->start);
675 data->streamer->total_byte = 0;
674 //fprintf (stderr, "stream_func(): start.\n"); 676 //fprintf (stderr, "stream_func(): start.\n");
675 677
676 while(1) { 678 while(1) {
677 if(f_exit) 679 if(f_exit)
678 break; 680 break;
682 /* no entry in the queue */ 684 /* no entry in the queue */
683 if(qbuf == NULL) { 685 if(qbuf == NULL) {
684 //fprintf (stderr, "stream_func(): dequeue() return NULL pointer. streaming abort.\n"); 686 //fprintf (stderr, "stream_func(): dequeue() return NULL pointer. streaming abort.\n");
685 continue; 687 continue;
686 } 688 }
689 data->streamer->total_byte += qbuf->size;
687 // クリティカルセクション長いのなんとかしたいなぁ… 690 // クリティカルセクション長いのなんとかしたいなぁ…
688 // ToDo: memcpy とかクリティカルセクションの外に出す 691 // ToDo: memcpy とかクリティカルセクションの外に出す
689 // 3.2 tdata->streamer->mutex を lock 692 // 3.2 tdata->streamer->mutex を lock
690 //fprintf (stderr, "stream_func(): mutex lock try.\n"); 693 //fprintf (stderr, "stream_func(): mutex lock try.\n");
691 pthread_mutex_lock(&data->streamer->mutex); 694 pthread_mutex_lock(&data->streamer->mutex);