# HG changeset patch # User Naoya OYAMA # Date 1286901564 -32400 # Node ID 7b663556757f2a5565e240fe0a7f2fe2af10963c # Parent 20442921bff59dec4e2be8f8ac22813ba73e15e0 modify CONTENT-LENGTH for indefinite recording. diff -r 20442921bff5 -r 7b663556757f src/http.c --- a/src/http.c Tue Oct 12 05:56:26 2010 +0900 +++ b/src/http.c Wed Oct 13 01:39:24 2010 +0900 @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -602,6 +603,7 @@ // TS_BITRATEはやっつけ仕事過ぎる気がします #define TS_BITRATE (10*1000*1000/8) +#define MAX_STREAMING ((off_t)100*1000*1000*1000) static off_t get_streaming_length (void) { @@ -614,20 +616,17 @@ clock_gettime(CLOCK_REALTIME, &cur); off_t bitrate = 0; - if ( cur.tv_nsec < tdata->streamer->start.tv_nsec ) { - diff.tv_nsec = cur.tv_nsec - tdata->streamer->start.tv_nsec +1e9; - diff.tv_sec = cur.tv_sec - tdata->streamer->start.tv_sec -1; - } else { - diff.tv_nsec = cur.tv_nsec - tdata->streamer->start.tv_nsec; - diff.tv_sec = cur.tv_sec - tdata->streamer->start.tv_sec; + if ( tdata->indefinite ) { + return MAX_STREAMING; } + diff.tv_nsec = cur.tv_nsec - tdata->streamer->start.tv_nsec; + diff.tv_sec = cur.tv_sec - tdata->streamer->start.tv_sec; if ( diff.tv_sec < 1 ) { bitrate = TS_BITRATE; } else { bitrate = (((off_t)tdata->streamer->total_byte)*1e9) / - ( (((off_t)diff.tv_sec)*1e9) + (diff.tv_sec/1e9)); - bitrate = bitrate; + ( (((off_t)diff.tv_sec)*1e9) + diff.tv_nsec); } time(&cur_time);