Hi Klaas,
The comments above this section seem to tell me that info_file is for the tail:
#
# At this point brutefir has completed its output, and we have in memory
# several seconds of readahead followed by the tail. First we dump the tail
# to disk, so it is ready for the next invocation of this process.
tail_bytes = int(samplerate*TAIL_SECONDS)*CHANNELS*format.width
if readahead.total_bytes>=tail_bytes:
info_file = open(info_filename+'.new','w')
info_file.write(str(samplerate)+'\n')
info_file.write(format.brutefir_name+'\n')
info_file.close()
If I understand this correctly, the format info is for the tail file, not the current stream which will be "tail merged".
Since the wrapper reads the tail of the previous stream, the read_tail() occurs before the section above:
tail_filename = os.path.join(TMPDIR,'tail-%s.pcm'%(client_id,))
info_filename = os.path.join(TMPDIR,'tail-%s.txt'%(client_id,))
saved_tail = read_tail(tail_filename,info_filename,client_id,format,samplerate)
In calling read_tail(), info_filename is info for the tail file, while samplerate is for the current stream. I think the call may need to be be changed to:
tail_filename = os.path.join(TMPDIR,'tail-%s.pcm'%(client_id,))
info_filename = os.path.join(TMPDIR,'tail-%s.txt'%(client_id,))
saved_tail = read_tail(tail_filename,info_filename,client_id,format,samplerate, format.bitspersample)
and read_tail checks that the tail samplerate *and( bitspersample are the same as for the current stream.
Cheers,
Mervin