Why does VLC use file descriptor in IO?

This forum is about all development around libVLC.
haiying7
Blank Cone
Blank Cone
Posts: 23
Joined: 24 Jan 2011 09:15
VLC version: vlc 1.1.7
Operating System: Mac OS and Linux
Location: Hong Kong

Why does VLC use file descriptor in IO?

Postby haiying7 » 13 May 2011 11:44

Hi,

I notice that VLC uses net_Write() to write data to a file descriptor in "io.c"(src/network/), and then, read file descriptor line by line. Why not just read data from a buffer directly? What is the meaning of file descriptor here?

THX.

Rémi Denis-Courmont
Developer
Developer
Posts: 15323
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Why does VLC use file descriptor in IO?

Postby Rémi Denis-Courmont » 13 May 2011 15:12

There are no standard ways to do buffered and non-blocking I/O on sockets (fdopen() is not non-blocking and does not work with Winsock).

You are right that net_Gets() implementation makes a lot of system calls, which is suboptimal. But in most performance-critical code paths, net_Gets() is anyway not used.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 3 guests