Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Play file(s) from RAM
10-11-2019, 09:34 (This post was last modified: 10-11-2019 09:34 by lafuente.)
Post: #1
Play file(s) from RAM
Hi,

I'd like to know if Minimserver play file(s) from RAM ?
If not, do you think it may improve sound quality ?

Thank,
Manu.
Find all posts by this user
Quote this message in a reply
10-11-2019, 10:48
Post: #2
RE: Play file(s) from RAM
MinimServer plays files from an internal memory buffer but does not load the entire file into memory before starting to play. This would cause a delay before starting to play the file and would make gapless playback of album tracks impossible. It would also require more RAM than is available on most of the platforms that MinimServer supports. I don't have any plans to change this.
Find all posts by this user
Quote this message in a reply
11-11-2019, 02:06
Post: #3
RE: Play file(s) from RAM
(10-11-2019 10:48)simoncn Wrote:  MinimServer plays files from an internal memory buffer but does not load the entire file into memory before starting to play. This would cause a delay before starting to play the file and would make gapless playback of album tracks impossible. It would also require more RAM than is available on most of the platforms that MinimServer supports. I don't have any plans to change this.

Interesting. What is the size if this buffer, if I may ask ?
Find all posts by this user
Quote this message in a reply
11-11-2019, 09:17
Post: #4
RE: Play file(s) from RAM
(10-11-2019 10:48)simoncn Wrote:  MinimServer plays files from an internal memory buffer but does not load the entire file into memory before starting to play. This would cause a delay before starting to play the file and would make gapless playback of album tracks impossible. It would also require more RAM than is available on most of the platforms that MinimServer supports. I don't have any plans to change this.

Do you mean "MiminServer streams"?
Find all posts by this user
Quote this message in a reply
11-11-2019, 11:07 (This post was last modified: 11-11-2019 11:07 by simoncn.)
Post: #5
RE: Play file(s) from RAM
Yes, to be strictly correct, I do. Smile
Find all posts by this user
Quote this message in a reply
12-11-2019, 11:14
Post: #6
RE: Play file(s) from RAM
Actually, the difference between "playing" and "streaming" is very significant in this context.

A renderer that plays audio can assemble the audio data in a memory buffer and control all implementation details of how audio is played from that buffer. For a server such as MinimServer, the output is a network stream that is subject to multiple levels of buffering and packetization by lower levels of networking code, controlled by TCP handshaking between the sending and receiving ends of the network connection. In parallel to this, the server needs to read audio data from disk (when playing a local file) or from the network (when playing an internet radio stream) and might also be doing other processing such as transcoding or convolution which can require routing the audio data through a separate FFmpeg process before it goes to the network output.

To cater for all these scenarios in the simplest and cleanest way (simplicity is usually beneficial for sound quality), MinimServer uses a multithreaded streaming architecture with different internal streaming connections to handle these different scenarios. For the most common scenario of streaming a local file, there is a reader thread for reading from disk and a writer thread for writing to the renderer via the network. These threads are connected by a circular ring of memory buffers, with the reader thread filling the next available buffer when it becomes empty and the writer thread emptying the next available buffer when it becomes full.

There are 5 buffers in this ring, each with a size of 16 KB. I have experimented with different buffer sizes and numbers of buffers and have found no benefit in increasing either the number of buffers or the buffer size. Because MinimServer can read data from the file more quickly that the renderer can accept it for playing, the buffer ring is always full and waiting for the renderer to accept the next buffer so that it can be refilled by the reader thread. The network connection can only send packets of about 1400 bytes each, so having a larger amount of data queued up in memory makes no difference to what happens when the data is written.
Find all posts by this user
Quote this message in a reply
12-11-2019, 14:38
Post: #7
RE: Play file(s) from RAM
I agree.
At our company we also used circular buffers although in a completely different scenario.

Back to the OP, I see no benefit in "playing from ram", at least on the server side. And I think the renderer(s) already "play from ram". In this client-server architecture, I cannot imagine how having more data in RAM than needed on the media server would yield any improvement.
I think, if anything else, one thing one might want to do is use SSD storage just to avoid the noise of the spinning disk(s)

My .02
Find all posts by this user
Quote this message in a reply
Yesterday, 12:34
Post: #8
RE: Play file(s) from RAM
Thank Simon,
This make sense.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)