* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* sap.c : SAP announce handler
|
|
|
|
*****************************************************************************
|
LGPL
Re-license almost all of libVLC and libVLCcore to LGPLv2.1+
This move was authorized by the developers, either:
- by e-mail,
- by vote at the VideoLAN Dev Days 2011,
- on the license website,
- in a contract, oral or written.
No objection was raised, so far.
The developers agreeing are:
Justus Piater
Alexis Ballier
Alexander Bethke
Mohammed Adnène Trojette
Alex Converse
Alexey Sokolov
Alexis de Lattre
Andre Pang
Anthony Loiseau
Cyril Deguet
André Weber
Boris Dorès
Brieuc Jeunhomme
Benjamin Drung
Hugo Beauzée-Luyssen
Benoit Steiner
Benjamin Pracht
Bernie Purcell
Przemyslaw Fiala
Arnaud de Bossoreille de Ribou
Brad Smith
Nick Briggs
Christopher Rath
Christophe Courtaut
Christopher Mueller
Clement Chesnin
Andres Krapf
Damien Fouilleul
David Flynn
Sebastien Zwickert
Antoine Cellerier
Jérôme Decoodt
Jérome Decoodt
Dylan Yudaken
Eduard Babayan
Eugenio Jarosiewicz
Elliot Murphy
Eric Petit
Erwan Tulou
Etienne Membrives
Ludovic Fauvet
Fabio Ritrovato
Tobias Güntner
Jakub Wieczorek
Frédéric Crozat
Francois Cartegnie
Laurent Aimar
Florian G. Pflug
Felix Paul Kühne
Frank Enderle
Rafaël Carré
Simon Latapie
Gildas Bazin
Geoffroy Couprie
Julien / Gellule
Gildas Bazin
Arnaud Schauly
Toralf Niebuhr
Vicente Jimenez Aguilar
Derk-Jan Hartman
Henri Fallon
Ilkka Ollakka
Olivier Teulière
Rémi Duraffort
Jakob Leben
Jean-Baptiste Kempf
Jean-Paul Saman
Jean-Philippe Grimaldi
Jean-François Massol
Gaël Hendryckx
Jakob Leben
Jean-Marc Dressler
Jai Menon
Johan Bilien
Johann Ransay
Joris van Rooij
JP Dinger
Jean-Philippe André
Adrien Grand
Juha Jeronen
Juho Vähä-Herttua
Kaarlo Raiha
Kaarlo Raiha
Kamil Baldyga
Keary Griffin
Ken Self
KO Myung-Hun
Pierre Ynard
Filippo Carone
Loïc Minier
Luca Barbato
Lucas C. Villa Real
Lukas Durfina
Adrien Maglo
Marc Ariberti
Mark Lee
Mark Moriarty
Martin Storsjö
Christophe Massiot
Michel Kaempf
Marian Ďurkovič
Mirsal Ennaime
Carlo Calabrò
Damien Lucas
Naohiro Koriyama
Basos G
Pierre Baillet
Vincent Penquerc'h
Olivier Aubert
Pankaj Yadav
Paul Corke
Pierre d'Herbemont
Philippe Morin
Antoine Lejeune
Michael Ploujnikov
Jean-Marc Dressler
Michael Hanselmann
Rafaël Carré
Ramiro Polla
Rémi Denis-Courmont
Renaud Dartus
Richard Shepherd
Faustino Osuna
Arnaud Vallat
Rob Jonson
Robert Jedrzejczyk
Steve Lhomme
Rocky Bernstein
Romain Goyet
Rov Juvano
Sam Hocevar
Martin T. H. Sandsmark
Sebastian Birk
Sébastien Escudier
Vincent Seguin
Fabio Ritrovato
Sigmund Augdal Helberg
Casian Andrei
Srikanth Raju
Hannes Domani
Stéphane Borel
Stephan Krempel
Stephan Assmus
Tony Castley
Pavlov Konstantin
Eric Petit
Tanguy Krotoff
Dennis van Amerongen
Michel Lespinasse
Can Wu
Xavier Marchesini
Sébastien Toque
Christophe Mutricy
Yoann Peronneau
Yohann Martineau
Yuval Tze
Scott Caudle
Clément Stenac
It is possible, that some minor piece of code was badly tracked, for
some reasons (SVN, mainly) or that some small developers did not answer.
However, as an "œuvre collective", defined as in "CPI 113-2 alinéa 3",
and seeing "Cour. Cass. 17 Mai 1978", and seeing that the editor and
the very vast majority of developers have agreed (> 99.99% of the code,
> 99% of developers), we are fine here.
2011-11-27 21:44:15 +01:00
|
|
|
* Copyright (C) 2002-2008 VLC authors and VideoLAN
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
*
|
2005-06-25 09:47:46 +02:00
|
|
|
* Authors: Clément Stenac <zorglub@videolan.org>
|
2019-09-04 21:10:51 +02:00
|
|
|
* Rémi Denis-Courmont
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
*
|
LGPL
Re-license almost all of libVLC and libVLCcore to LGPLv2.1+
This move was authorized by the developers, either:
- by e-mail,
- by vote at the VideoLAN Dev Days 2011,
- on the license website,
- in a contract, oral or written.
No objection was raised, so far.
The developers agreeing are:
Justus Piater
Alexis Ballier
Alexander Bethke
Mohammed Adnène Trojette
Alex Converse
Alexey Sokolov
Alexis de Lattre
Andre Pang
Anthony Loiseau
Cyril Deguet
André Weber
Boris Dorès
Brieuc Jeunhomme
Benjamin Drung
Hugo Beauzée-Luyssen
Benoit Steiner
Benjamin Pracht
Bernie Purcell
Przemyslaw Fiala
Arnaud de Bossoreille de Ribou
Brad Smith
Nick Briggs
Christopher Rath
Christophe Courtaut
Christopher Mueller
Clement Chesnin
Andres Krapf
Damien Fouilleul
David Flynn
Sebastien Zwickert
Antoine Cellerier
Jérôme Decoodt
Jérome Decoodt
Dylan Yudaken
Eduard Babayan
Eugenio Jarosiewicz
Elliot Murphy
Eric Petit
Erwan Tulou
Etienne Membrives
Ludovic Fauvet
Fabio Ritrovato
Tobias Güntner
Jakub Wieczorek
Frédéric Crozat
Francois Cartegnie
Laurent Aimar
Florian G. Pflug
Felix Paul Kühne
Frank Enderle
Rafaël Carré
Simon Latapie
Gildas Bazin
Geoffroy Couprie
Julien / Gellule
Gildas Bazin
Arnaud Schauly
Toralf Niebuhr
Vicente Jimenez Aguilar
Derk-Jan Hartman
Henri Fallon
Ilkka Ollakka
Olivier Teulière
Rémi Duraffort
Jakob Leben
Jean-Baptiste Kempf
Jean-Paul Saman
Jean-Philippe Grimaldi
Jean-François Massol
Gaël Hendryckx
Jakob Leben
Jean-Marc Dressler
Jai Menon
Johan Bilien
Johann Ransay
Joris van Rooij
JP Dinger
Jean-Philippe André
Adrien Grand
Juha Jeronen
Juho Vähä-Herttua
Kaarlo Raiha
Kaarlo Raiha
Kamil Baldyga
Keary Griffin
Ken Self
KO Myung-Hun
Pierre Ynard
Filippo Carone
Loïc Minier
Luca Barbato
Lucas C. Villa Real
Lukas Durfina
Adrien Maglo
Marc Ariberti
Mark Lee
Mark Moriarty
Martin Storsjö
Christophe Massiot
Michel Kaempf
Marian Ďurkovič
Mirsal Ennaime
Carlo Calabrò
Damien Lucas
Naohiro Koriyama
Basos G
Pierre Baillet
Vincent Penquerc'h
Olivier Aubert
Pankaj Yadav
Paul Corke
Pierre d'Herbemont
Philippe Morin
Antoine Lejeune
Michael Ploujnikov
Jean-Marc Dressler
Michael Hanselmann
Rafaël Carré
Ramiro Polla
Rémi Denis-Courmont
Renaud Dartus
Richard Shepherd
Faustino Osuna
Arnaud Vallat
Rob Jonson
Robert Jedrzejczyk
Steve Lhomme
Rocky Bernstein
Romain Goyet
Rov Juvano
Sam Hocevar
Martin T. H. Sandsmark
Sebastian Birk
Sébastien Escudier
Vincent Seguin
Fabio Ritrovato
Sigmund Augdal Helberg
Casian Andrei
Srikanth Raju
Hannes Domani
Stéphane Borel
Stephan Krempel
Stephan Assmus
Tony Castley
Pavlov Konstantin
Eric Petit
Tanguy Krotoff
Dennis van Amerongen
Michel Lespinasse
Can Wu
Xavier Marchesini
Sébastien Toque
Christophe Mutricy
Yoann Peronneau
Yohann Martineau
Yuval Tze
Scott Caudle
Clément Stenac
It is possible, that some minor piece of code was badly tracked, for
some reasons (SVN, mainly) or that some small developers did not answer.
However, as an "œuvre collective", defined as in "CPI 113-2 alinéa 3",
and seeing "Cour. Cass. 17 Mai 1978", and seeing that the editor and
the very vast majority of developers have agreed (> 99.99% of the code,
> 99% of developers), we are fine here.
2011-11-27 21:44:15 +01:00
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU Lesser General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2.1 of the License, or
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
LGPL
Re-license almost all of libVLC and libVLCcore to LGPLv2.1+
This move was authorized by the developers, either:
- by e-mail,
- by vote at the VideoLAN Dev Days 2011,
- on the license website,
- in a contract, oral or written.
No objection was raised, so far.
The developers agreeing are:
Justus Piater
Alexis Ballier
Alexander Bethke
Mohammed Adnène Trojette
Alex Converse
Alexey Sokolov
Alexis de Lattre
Andre Pang
Anthony Loiseau
Cyril Deguet
André Weber
Boris Dorès
Brieuc Jeunhomme
Benjamin Drung
Hugo Beauzée-Luyssen
Benoit Steiner
Benjamin Pracht
Bernie Purcell
Przemyslaw Fiala
Arnaud de Bossoreille de Ribou
Brad Smith
Nick Briggs
Christopher Rath
Christophe Courtaut
Christopher Mueller
Clement Chesnin
Andres Krapf
Damien Fouilleul
David Flynn
Sebastien Zwickert
Antoine Cellerier
Jérôme Decoodt
Jérome Decoodt
Dylan Yudaken
Eduard Babayan
Eugenio Jarosiewicz
Elliot Murphy
Eric Petit
Erwan Tulou
Etienne Membrives
Ludovic Fauvet
Fabio Ritrovato
Tobias Güntner
Jakub Wieczorek
Frédéric Crozat
Francois Cartegnie
Laurent Aimar
Florian G. Pflug
Felix Paul Kühne
Frank Enderle
Rafaël Carré
Simon Latapie
Gildas Bazin
Geoffroy Couprie
Julien / Gellule
Gildas Bazin
Arnaud Schauly
Toralf Niebuhr
Vicente Jimenez Aguilar
Derk-Jan Hartman
Henri Fallon
Ilkka Ollakka
Olivier Teulière
Rémi Duraffort
Jakob Leben
Jean-Baptiste Kempf
Jean-Paul Saman
Jean-Philippe Grimaldi
Jean-François Massol
Gaël Hendryckx
Jakob Leben
Jean-Marc Dressler
Jai Menon
Johan Bilien
Johann Ransay
Joris van Rooij
JP Dinger
Jean-Philippe André
Adrien Grand
Juha Jeronen
Juho Vähä-Herttua
Kaarlo Raiha
Kaarlo Raiha
Kamil Baldyga
Keary Griffin
Ken Self
KO Myung-Hun
Pierre Ynard
Filippo Carone
Loïc Minier
Luca Barbato
Lucas C. Villa Real
Lukas Durfina
Adrien Maglo
Marc Ariberti
Mark Lee
Mark Moriarty
Martin Storsjö
Christophe Massiot
Michel Kaempf
Marian Ďurkovič
Mirsal Ennaime
Carlo Calabrò
Damien Lucas
Naohiro Koriyama
Basos G
Pierre Baillet
Vincent Penquerc'h
Olivier Aubert
Pankaj Yadav
Paul Corke
Pierre d'Herbemont
Philippe Morin
Antoine Lejeune
Michael Ploujnikov
Jean-Marc Dressler
Michael Hanselmann
Rafaël Carré
Ramiro Polla
Rémi Denis-Courmont
Renaud Dartus
Richard Shepherd
Faustino Osuna
Arnaud Vallat
Rob Jonson
Robert Jedrzejczyk
Steve Lhomme
Rocky Bernstein
Romain Goyet
Rov Juvano
Sam Hocevar
Martin T. H. Sandsmark
Sebastian Birk
Sébastien Escudier
Vincent Seguin
Fabio Ritrovato
Sigmund Augdal Helberg
Casian Andrei
Srikanth Raju
Hannes Domani
Stéphane Borel
Stephan Krempel
Stephan Assmus
Tony Castley
Pavlov Konstantin
Eric Petit
Tanguy Krotoff
Dennis van Amerongen
Michel Lespinasse
Can Wu
Xavier Marchesini
Sébastien Toque
Christophe Mutricy
Yoann Peronneau
Yohann Martineau
Yuval Tze
Scott Caudle
Clément Stenac
It is possible, that some minor piece of code was badly tracked, for
some reasons (SVN, mainly) or that some small developers did not answer.
However, as an "œuvre collective", defined as in "CPI 113-2 alinéa 3",
and seeing "Cour. Cass. 17 Mai 1978", and seeing that the editor and
the very vast majority of developers have agreed (> 99.99% of the code,
> 99% of developers), we are fine here.
2011-11-27 21:44:15 +01:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License for more details.
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
*
|
LGPL
Re-license almost all of libVLC and libVLCcore to LGPLv2.1+
This move was authorized by the developers, either:
- by e-mail,
- by vote at the VideoLAN Dev Days 2011,
- on the license website,
- in a contract, oral or written.
No objection was raised, so far.
The developers agreeing are:
Justus Piater
Alexis Ballier
Alexander Bethke
Mohammed Adnène Trojette
Alex Converse
Alexey Sokolov
Alexis de Lattre
Andre Pang
Anthony Loiseau
Cyril Deguet
André Weber
Boris Dorès
Brieuc Jeunhomme
Benjamin Drung
Hugo Beauzée-Luyssen
Benoit Steiner
Benjamin Pracht
Bernie Purcell
Przemyslaw Fiala
Arnaud de Bossoreille de Ribou
Brad Smith
Nick Briggs
Christopher Rath
Christophe Courtaut
Christopher Mueller
Clement Chesnin
Andres Krapf
Damien Fouilleul
David Flynn
Sebastien Zwickert
Antoine Cellerier
Jérôme Decoodt
Jérome Decoodt
Dylan Yudaken
Eduard Babayan
Eugenio Jarosiewicz
Elliot Murphy
Eric Petit
Erwan Tulou
Etienne Membrives
Ludovic Fauvet
Fabio Ritrovato
Tobias Güntner
Jakub Wieczorek
Frédéric Crozat
Francois Cartegnie
Laurent Aimar
Florian G. Pflug
Felix Paul Kühne
Frank Enderle
Rafaël Carré
Simon Latapie
Gildas Bazin
Geoffroy Couprie
Julien / Gellule
Gildas Bazin
Arnaud Schauly
Toralf Niebuhr
Vicente Jimenez Aguilar
Derk-Jan Hartman
Henri Fallon
Ilkka Ollakka
Olivier Teulière
Rémi Duraffort
Jakob Leben
Jean-Baptiste Kempf
Jean-Paul Saman
Jean-Philippe Grimaldi
Jean-François Massol
Gaël Hendryckx
Jakob Leben
Jean-Marc Dressler
Jai Menon
Johan Bilien
Johann Ransay
Joris van Rooij
JP Dinger
Jean-Philippe André
Adrien Grand
Juha Jeronen
Juho Vähä-Herttua
Kaarlo Raiha
Kaarlo Raiha
Kamil Baldyga
Keary Griffin
Ken Self
KO Myung-Hun
Pierre Ynard
Filippo Carone
Loïc Minier
Luca Barbato
Lucas C. Villa Real
Lukas Durfina
Adrien Maglo
Marc Ariberti
Mark Lee
Mark Moriarty
Martin Storsjö
Christophe Massiot
Michel Kaempf
Marian Ďurkovič
Mirsal Ennaime
Carlo Calabrò
Damien Lucas
Naohiro Koriyama
Basos G
Pierre Baillet
Vincent Penquerc'h
Olivier Aubert
Pankaj Yadav
Paul Corke
Pierre d'Herbemont
Philippe Morin
Antoine Lejeune
Michael Ploujnikov
Jean-Marc Dressler
Michael Hanselmann
Rafaël Carré
Ramiro Polla
Rémi Denis-Courmont
Renaud Dartus
Richard Shepherd
Faustino Osuna
Arnaud Vallat
Rob Jonson
Robert Jedrzejczyk
Steve Lhomme
Rocky Bernstein
Romain Goyet
Rov Juvano
Sam Hocevar
Martin T. H. Sandsmark
Sebastian Birk
Sébastien Escudier
Vincent Seguin
Fabio Ritrovato
Sigmund Augdal Helberg
Casian Andrei
Srikanth Raju
Hannes Domani
Stéphane Borel
Stephan Krempel
Stephan Assmus
Tony Castley
Pavlov Konstantin
Eric Petit
Tanguy Krotoff
Dennis van Amerongen
Michel Lespinasse
Can Wu
Xavier Marchesini
Sébastien Toque
Christophe Mutricy
Yoann Peronneau
Yohann Martineau
Yuval Tze
Scott Caudle
Clément Stenac
It is possible, that some minor piece of code was badly tracked, for
some reasons (SVN, mainly) or that some small developers did not answer.
However, as an "œuvre collective", defined as in "CPI 113-2 alinéa 3",
and seeing "Cour. Cass. 17 Mai 1978", and seeing that the editor and
the very vast majority of developers have agreed (> 99.99% of the code,
> 99% of developers), we are fine here.
2011-11-27 21:44:15 +01:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
*****************************************************************************/
|
|
|
|
|
2008-01-23 22:50:58 +01:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2008-05-31 20:56:22 +02:00
|
|
|
#include <vlc_common.h>
|
2006-09-12 20:49:41 +02:00
|
|
|
|
2017-02-18 11:20:19 +01:00
|
|
|
#include <stdnoreturn.h>
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
#include <stdlib.h> /* free() */
|
|
|
|
#include <stdio.h> /* sprintf() */
|
2007-09-18 17:44:47 +02:00
|
|
|
#include <string.h>
|
2008-01-24 17:08:13 +01:00
|
|
|
#include <assert.h>
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
|
2006-11-26 15:20:34 +01:00
|
|
|
#include <vlc_sout.h>
|
|
|
|
#include <vlc_network.h>
|
2017-05-29 17:36:54 +02:00
|
|
|
#include <vlc_memstream.h>
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
|
2006-11-26 15:20:34 +01:00
|
|
|
#include "stream_output.h"
|
2008-03-31 02:24:56 +02:00
|
|
|
#include "libvlc.h"
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
|
2005-05-31 21:48:21 +02:00
|
|
|
/* SAP is always on that port */
|
2008-09-11 19:36:52 +02:00
|
|
|
#define IPPORT_SAP 9875
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
|
2014-06-20 18:34:45 +02:00
|
|
|
/* A SAP session descriptor, enqueued in the SAP handler queue */
|
2014-06-20 17:33:30 +02:00
|
|
|
struct session_descriptor_t
|
|
|
|
{
|
2014-06-20 18:34:45 +02:00
|
|
|
struct session_descriptor_t *next;
|
2017-05-29 17:36:54 +02:00
|
|
|
size_t length;
|
|
|
|
char *data;
|
2014-06-20 17:33:30 +02:00
|
|
|
};
|
|
|
|
|
2005-05-31 21:48:21 +02:00
|
|
|
/* A SAP announce address. For each of these, we run the
|
|
|
|
* control flow algorithm */
|
2008-09-11 19:36:52 +02:00
|
|
|
typedef struct sap_address_t
|
2005-05-31 21:48:21 +02:00
|
|
|
{
|
2008-09-11 19:36:52 +02:00
|
|
|
struct sap_address_t *next;
|
2005-05-31 21:48:21 +02:00
|
|
|
|
2008-09-11 19:36:52 +02:00
|
|
|
vlc_thread_t thread;
|
|
|
|
vlc_mutex_t lock;
|
|
|
|
vlc_cond_t wait;
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
|
2008-09-11 19:36:52 +02:00
|
|
|
char group[NI_MAXNUMERICHOST];
|
|
|
|
struct sockaddr_storage orig;
|
|
|
|
socklen_t origlen;
|
|
|
|
int fd;
|
|
|
|
unsigned interval;
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
|
2008-09-11 19:36:52 +02:00
|
|
|
unsigned session_count;
|
2014-06-20 18:34:45 +02:00
|
|
|
session_descriptor_t *first;
|
2008-09-11 19:36:52 +02:00
|
|
|
} sap_address_t;
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
|
2014-06-20 18:59:37 +02:00
|
|
|
static sap_address_t *sap_addrs = NULL;
|
2014-06-20 18:52:03 +02:00
|
|
|
static vlc_mutex_t sap_mutex = VLC_STATIC_MUTEX;
|
|
|
|
|
2008-09-11 19:36:52 +02:00
|
|
|
#define SAP_MAX_BUFFER 65534
|
|
|
|
#define MIN_INTERVAL 2
|
|
|
|
#define MAX_INTERVAL 300
|
2008-03-26 23:56:18 +01:00
|
|
|
|
2018-03-29 13:09:59 +02:00
|
|
|
noreturn static void *RunThread (void *);
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
|
2008-09-11 19:36:52 +02:00
|
|
|
static sap_address_t *AddressCreate (vlc_object_t *obj, const char *group)
|
|
|
|
{
|
|
|
|
int fd = net_ConnectUDP (obj, group, IPPORT_SAP, 255);
|
|
|
|
if (fd == -1)
|
|
|
|
return NULL;
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
|
2008-09-11 19:36:52 +02:00
|
|
|
sap_address_t *addr = malloc (sizeof (*addr));
|
|
|
|
if (addr == NULL)
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
{
|
2008-09-11 19:36:52 +02:00
|
|
|
net_Close (fd);
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
return NULL;
|
2008-03-26 23:56:18 +01:00
|
|
|
}
|
|
|
|
|
2008-09-11 19:36:52 +02:00
|
|
|
strlcpy (addr->group, group, sizeof (addr->group));
|
|
|
|
addr->fd = fd;
|
|
|
|
addr->origlen = sizeof (addr->orig);
|
|
|
|
getsockname (fd, (struct sockaddr *)&addr->orig, &addr->origlen);
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
|
2008-09-11 19:36:52 +02:00
|
|
|
addr->interval = var_CreateGetInteger (obj, "sap-interval");
|
|
|
|
vlc_mutex_init (&addr->lock);
|
|
|
|
vlc_cond_init (&addr->wait);
|
|
|
|
addr->session_count = 0;
|
|
|
|
addr->first = NULL;
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
|
2008-09-11 19:36:52 +02:00
|
|
|
if (vlc_clone (&addr->thread, RunThread, addr, VLC_THREAD_PRIORITY_LOW))
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
{
|
2008-09-11 19:36:52 +02:00
|
|
|
msg_Err (obj, "unable to spawn SAP announce thread");
|
|
|
|
net_Close (fd);
|
|
|
|
free (addr);
|
|
|
|
return NULL;
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
}
|
2008-09-11 19:36:52 +02:00
|
|
|
return addr;
|
|
|
|
}
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
|
2008-09-11 19:36:52 +02:00
|
|
|
static void AddressDestroy (sap_address_t *addr)
|
|
|
|
{
|
|
|
|
assert (addr->first == NULL);
|
|
|
|
|
|
|
|
vlc_cancel (addr->thread);
|
|
|
|
vlc_join (addr->thread, NULL);
|
|
|
|
vlc_cond_destroy (&addr->wait);
|
|
|
|
vlc_mutex_destroy (&addr->lock);
|
|
|
|
net_Close (addr->fd);
|
|
|
|
free (addr);
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* main SAP handler thread
|
|
|
|
* \param p_this the SAP Handler object
|
|
|
|
* \return nothing
|
|
|
|
*/
|
2017-02-18 11:20:19 +01:00
|
|
|
noreturn static void *RunThread (void *self)
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
{
|
2008-09-11 19:36:52 +02:00
|
|
|
sap_address_t *addr = self;
|
|
|
|
|
|
|
|
vlc_mutex_lock (&addr->lock);
|
|
|
|
mutex_cleanup_push (&addr->lock);
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
|
2008-08-16 18:30:46 +02:00
|
|
|
for (;;)
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
{
|
2014-06-20 18:34:45 +02:00
|
|
|
session_descriptor_t *p_session;
|
2018-06-22 13:19:24 +02:00
|
|
|
vlc_tick_t deadline;
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
|
2008-09-11 19:36:52 +02:00
|
|
|
while (addr->first == NULL)
|
|
|
|
vlc_cond_wait (&addr->wait, &addr->lock);
|
2008-08-16 18:23:43 +02:00
|
|
|
|
2008-09-11 19:36:52 +02:00
|
|
|
assert (addr->session_count > 0);
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
|
2018-06-20 08:37:11 +02:00
|
|
|
deadline = vlc_tick_now ();
|
2008-09-11 19:36:52 +02:00
|
|
|
for (p_session = addr->first; p_session; p_session = p_session->next)
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
{
|
2008-09-11 19:36:52 +02:00
|
|
|
send (addr->fd, p_session->data, p_session->length, 0);
|
2018-09-20 14:35:20 +02:00
|
|
|
deadline += vlc_tick_from_samples(addr->interval, addr->session_count);
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
|
2008-09-11 19:36:52 +02:00
|
|
|
if (vlc_cond_timedwait (&addr->wait, &addr->lock, deadline) == 0)
|
|
|
|
break; /* list may have changed! */
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
}
|
|
|
|
}
|
2008-09-11 19:36:52 +02:00
|
|
|
|
|
|
|
vlc_cleanup_pop ();
|
2015-02-17 22:10:16 +01:00
|
|
|
vlc_assert_unreachable ();
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
}
|
|
|
|
|
2014-06-20 18:59:37 +02:00
|
|
|
#undef sout_AnnounceRegisterSDP
|
2008-09-11 19:36:52 +02:00
|
|
|
/**
|
2014-06-20 18:59:37 +02:00
|
|
|
* Registers a new session with the announce handler, using a pregenerated SDP
|
|
|
|
*
|
|
|
|
* \param obj a VLC object
|
|
|
|
* \param sdp the SDP to register
|
|
|
|
* \param dst session address (needed for SAP address auto detection)
|
|
|
|
* \return the new session descriptor structure
|
2008-09-11 19:36:52 +02:00
|
|
|
*/
|
2014-06-20 18:59:37 +02:00
|
|
|
session_descriptor_t *
|
|
|
|
sout_AnnounceRegisterSDP (vlc_object_t *obj, const char *sdp,
|
|
|
|
const char *dst)
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
{
|
2007-02-10 14:15:50 +01:00
|
|
|
int i;
|
|
|
|
char psz_addr[NI_MAXNUMERICHOST];
|
2009-05-31 21:27:25 +02:00
|
|
|
union
|
|
|
|
{
|
|
|
|
struct sockaddr a;
|
|
|
|
struct sockaddr_in in;
|
|
|
|
struct sockaddr_in6 in6;
|
|
|
|
} addr;
|
2014-06-20 18:13:18 +02:00
|
|
|
socklen_t addrlen = 0;
|
|
|
|
struct addrinfo *res;
|
|
|
|
|
2014-06-20 18:59:37 +02:00
|
|
|
msg_Dbg (obj, "adding SAP session");
|
|
|
|
|
2014-06-20 18:13:18 +02:00
|
|
|
if (vlc_getaddrinfo (dst, 0, NULL, &res) == 0)
|
|
|
|
{
|
2018-05-18 08:00:54 +02:00
|
|
|
if ((size_t)res->ai_addrlen <= sizeof (addr))
|
2014-06-20 18:13:18 +02:00
|
|
|
memcpy (&addr, res->ai_addr, res->ai_addrlen);
|
|
|
|
addrlen = res->ai_addrlen;
|
|
|
|
freeaddrinfo (res);
|
|
|
|
}
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
|
2018-05-18 08:00:54 +02:00
|
|
|
if (addrlen == 0 || (size_t)addrlen > sizeof (addr))
|
2005-07-27 18:30:19 +02:00
|
|
|
{
|
2014-06-20 18:59:37 +02:00
|
|
|
msg_Err (obj, "No/invalid address specified for SAP announce" );
|
2014-06-20 18:34:45 +02:00
|
|
|
return NULL;
|
2005-07-27 18:30:19 +02:00
|
|
|
}
|
2005-05-31 21:48:21 +02:00
|
|
|
|
2007-02-10 14:15:50 +01:00
|
|
|
/* Determine SAP multicast address automatically */
|
2009-05-31 21:27:25 +02:00
|
|
|
switch (addr.a.sa_family)
|
2005-07-27 18:30:19 +02:00
|
|
|
{
|
2013-06-05 15:41:18 +02:00
|
|
|
#if defined (HAVE_INET_PTON) || defined (_WIN32)
|
2005-07-27 20:05:22 +02:00
|
|
|
case AF_INET6:
|
|
|
|
{
|
|
|
|
/* See RFC3513 for list of valid IPv6 scopes */
|
2009-05-31 21:27:25 +02:00
|
|
|
struct in6_addr *a6 = &addr.in6.sin6_addr;
|
2005-07-27 20:05:22 +02:00
|
|
|
|
|
|
|
memcpy( a6->s6_addr + 2, "\x00\x00\x00\x00\x00\x00"
|
|
|
|
"\x00\x00\x00\x00\x00\x02\x7f\xfe", 14 );
|
|
|
|
if( IN6_IS_ADDR_MULTICAST( a6 ) )
|
2007-02-09 22:51:43 +01:00
|
|
|
/* force flags to zero, preserve scope */
|
2006-11-11 16:48:05 +01:00
|
|
|
a6->s6_addr[1] &= 0xf;
|
2005-07-27 20:05:22 +02:00
|
|
|
else
|
|
|
|
/* Unicast IPv6 - assume global scope */
|
|
|
|
memcpy( a6->s6_addr, "\xff\x0e", 2 );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
2005-05-31 22:32:49 +02:00
|
|
|
|
2005-07-27 20:05:22 +02:00
|
|
|
case AF_INET:
|
2005-05-31 21:48:21 +02:00
|
|
|
{
|
2005-07-27 20:05:22 +02:00
|
|
|
/* See RFC2365 for IPv4 scopes */
|
2009-05-31 21:27:25 +02:00
|
|
|
uint32_t ipv4 = addr.in.sin_addr.s_addr;
|
2005-07-27 20:05:22 +02:00
|
|
|
|
|
|
|
/* 224.0.0.0/24 => 224.0.0.255 */
|
2009-05-31 21:27:25 +02:00
|
|
|
if ((ipv4 & htonl (0xffffff00)) == htonl (0xe0000000))
|
|
|
|
ipv4 = htonl (0xe00000ff);
|
2005-07-27 20:05:22 +02:00
|
|
|
else
|
|
|
|
/* 239.255.0.0/16 => 239.255.255.255 */
|
2009-05-31 21:27:25 +02:00
|
|
|
if ((ipv4 & htonl (0xffff0000)) == htonl (0xefff0000))
|
|
|
|
ipv4 = htonl (0xefffffff);
|
2005-07-27 20:05:22 +02:00
|
|
|
else
|
|
|
|
/* 239.192.0.0/14 => 239.195.255.255 */
|
2009-05-31 21:27:25 +02:00
|
|
|
if ((ipv4 & htonl (0xfffc0000)) == htonl (0xefc00000))
|
|
|
|
ipv4 = htonl (0xefc3ffff);
|
2005-07-27 20:05:22 +02:00
|
|
|
else
|
2009-05-31 21:27:25 +02:00
|
|
|
if ((ipv4 & htonl (0xff000000)) == htonl (0xef000000))
|
2006-02-28 15:52:40 +01:00
|
|
|
ipv4 = 0;
|
|
|
|
else
|
2005-07-27 20:05:22 +02:00
|
|
|
/* other addresses => 224.2.127.254 */
|
2009-05-31 21:27:25 +02:00
|
|
|
ipv4 = htonl (0xe0027ffe);
|
2006-11-10 18:40:03 +01:00
|
|
|
|
2006-02-28 15:52:40 +01:00
|
|
|
if( ipv4 == 0 )
|
|
|
|
{
|
2014-06-20 18:59:37 +02:00
|
|
|
msg_Err (obj, "Out-of-scope multicast address "
|
|
|
|
"not supported by SAP");
|
2014-06-20 18:34:45 +02:00
|
|
|
return NULL;
|
2006-02-28 15:52:40 +01:00
|
|
|
}
|
|
|
|
|
2009-05-31 21:27:25 +02:00
|
|
|
addr.in.sin_addr.s_addr = ipv4;
|
2005-07-27 20:05:22 +02:00
|
|
|
break;
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
}
|
2005-10-23 12:06:49 +02:00
|
|
|
|
2005-07-27 20:05:22 +02:00
|
|
|
default:
|
2018-07-11 18:14:59 +02:00
|
|
|
msg_Err (obj, "Address family %u not supported by SAP",
|
|
|
|
(unsigned)addr.a.sa_family);
|
2014-06-20 18:34:45 +02:00
|
|
|
return NULL;
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
}
|
2005-07-27 20:05:22 +02:00
|
|
|
|
2009-05-31 21:27:25 +02:00
|
|
|
i = vlc_getnameinfo( &addr.a, addrlen,
|
2005-07-27 20:05:22 +02:00
|
|
|
psz_addr, sizeof( psz_addr ), NULL, NI_NUMERICHOST );
|
|
|
|
|
|
|
|
if( i )
|
2005-07-27 18:30:19 +02:00
|
|
|
{
|
2014-06-20 18:59:37 +02:00
|
|
|
msg_Err (obj, "%s", gai_strerror (i));
|
2014-06-20 18:34:45 +02:00
|
|
|
return NULL;
|
2005-07-27 18:30:19 +02:00
|
|
|
}
|
2005-05-31 21:48:21 +02:00
|
|
|
|
2008-09-11 19:36:52 +02:00
|
|
|
/* Find/create SAP address thread */
|
2014-06-20 18:59:37 +02:00
|
|
|
sap_address_t *sap_addr;
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
|
2014-06-20 18:59:37 +02:00
|
|
|
msg_Dbg (obj, "using SAP address: %s", psz_addr);
|
2014-06-20 18:52:03 +02:00
|
|
|
vlc_mutex_lock (&sap_mutex);
|
2014-06-20 18:59:37 +02:00
|
|
|
for (sap_addr = sap_addrs; sap_addr; sap_addr = sap_addr->next)
|
2008-09-11 19:36:52 +02:00
|
|
|
if (!strcmp (psz_addr, sap_addr->group))
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
break;
|
2005-07-27 18:30:19 +02:00
|
|
|
|
2008-09-11 19:36:52 +02:00
|
|
|
if (sap_addr == NULL)
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
{
|
2014-06-20 18:59:37 +02:00
|
|
|
sap_addr = AddressCreate (obj, psz_addr);
|
2008-09-11 19:36:52 +02:00
|
|
|
if (sap_addr == NULL)
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
{
|
2014-06-20 18:52:03 +02:00
|
|
|
vlc_mutex_unlock (&sap_mutex);
|
2014-06-20 18:34:45 +02:00
|
|
|
return NULL;
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
}
|
2014-06-20 18:59:37 +02:00
|
|
|
sap_addr->next = sap_addrs;
|
|
|
|
sap_addrs = sap_addr;
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
}
|
2008-09-11 19:36:52 +02:00
|
|
|
/* Switch locks.
|
|
|
|
* NEVER take the global SAP lock when holding a SAP thread lock! */
|
|
|
|
vlc_mutex_lock (&sap_addr->lock);
|
2014-06-20 18:52:03 +02:00
|
|
|
vlc_mutex_unlock (&sap_mutex);
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
|
2017-05-29 17:36:54 +02:00
|
|
|
session_descriptor_t *session = malloc(sizeof (*session));
|
2014-06-20 18:34:45 +02:00
|
|
|
if (unlikely(session == NULL))
|
2017-05-29 17:36:54 +02:00
|
|
|
goto out; /* NOTE: we should destroy the thread if left unused */
|
|
|
|
|
2014-06-20 18:34:45 +02:00
|
|
|
session->next = sap_addr->first;
|
2005-07-27 18:30:19 +02:00
|
|
|
|
2007-02-10 14:15:50 +01:00
|
|
|
/* Build the SAP Headers */
|
2017-05-29 17:36:54 +02:00
|
|
|
struct vlc_memstream stream;
|
|
|
|
vlc_memstream_open(&stream);
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
|
2007-02-10 14:15:50 +01:00
|
|
|
/* SAPv1, not encrypted, not compressed */
|
2017-05-29 17:36:54 +02:00
|
|
|
uint8_t flags = 0x20;
|
|
|
|
#ifdef AF_INET6
|
|
|
|
if (sap_addr->orig.ss_family == AF_INET6)
|
|
|
|
flags |= 0x10;
|
|
|
|
#endif
|
|
|
|
vlc_memstream_putc(&stream, flags);
|
|
|
|
vlc_memstream_putc(&stream, 0x00); /* No authentication length */
|
2018-06-20 08:37:11 +02:00
|
|
|
vlc_memstream_write(&stream, &(uint16_t){ vlc_tick_now() }, 2); /* ID hash */
|
2007-02-10 14:15:50 +01:00
|
|
|
|
2014-06-20 17:57:09 +02:00
|
|
|
switch (sap_addr->orig.ss_family)
|
2007-02-10 14:15:50 +01:00
|
|
|
{
|
|
|
|
#ifdef AF_INET6
|
|
|
|
case AF_INET6:
|
|
|
|
{
|
2014-06-20 17:57:09 +02:00
|
|
|
const struct in6_addr *a6 =
|
|
|
|
&((const struct sockaddr_in6 *)&sap_addr->orig)->sin6_addr;
|
2017-05-29 17:36:54 +02:00
|
|
|
vlc_memstream_write(&stream, &a6, 16);
|
2007-02-10 14:15:50 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
case AF_INET:
|
|
|
|
{
|
2014-06-20 17:57:09 +02:00
|
|
|
const struct in_addr *a4 =
|
|
|
|
&((const struct sockaddr_in *)&sap_addr->orig)->sin_addr;
|
2017-05-29 17:36:54 +02:00
|
|
|
vlc_memstream_write(&stream, &a4, 4);
|
2007-02-10 14:15:50 +01:00
|
|
|
break;
|
|
|
|
}
|
2017-05-29 17:36:54 +02:00
|
|
|
default:
|
|
|
|
vlc_assert_unreachable ();
|
2007-02-10 14:15:50 +01:00
|
|
|
}
|
|
|
|
|
2017-05-29 17:36:54 +02:00
|
|
|
vlc_memstream_puts(&stream, "application/sdp");
|
|
|
|
vlc_memstream_putc(&stream, '\0');
|
2007-02-10 14:15:50 +01:00
|
|
|
|
|
|
|
/* Build the final message */
|
2017-05-29 17:36:54 +02:00
|
|
|
vlc_memstream_puts(&stream, sdp);
|
|
|
|
|
|
|
|
if (vlc_memstream_close(&stream))
|
|
|
|
{
|
|
|
|
free(session);
|
|
|
|
session = NULL;
|
|
|
|
goto out;
|
|
|
|
}
|
2004-08-29 23:26:16 +02:00
|
|
|
|
2017-05-29 17:36:54 +02:00
|
|
|
session->data = stream.ptr;
|
|
|
|
session->length = stream.length;
|
|
|
|
sap_addr->first = session;
|
2008-09-11 19:36:52 +02:00
|
|
|
sap_addr->session_count++;
|
|
|
|
vlc_cond_signal (&sap_addr->wait);
|
2017-05-29 17:36:54 +02:00
|
|
|
out:
|
2008-09-11 19:36:52 +02:00
|
|
|
vlc_mutex_unlock (&sap_addr->lock);
|
2014-06-20 18:34:45 +02:00
|
|
|
return session;
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
}
|
|
|
|
|
2014-06-20 18:59:37 +02:00
|
|
|
#undef sout_AnnounceUnRegister
|
2008-09-11 19:36:52 +02:00
|
|
|
/**
|
2014-06-20 18:59:37 +02:00
|
|
|
* Unregisters an existing session
|
|
|
|
*
|
|
|
|
* \param obj a VLC object
|
|
|
|
* \param session the session descriptor
|
2008-09-11 19:36:52 +02:00
|
|
|
*/
|
2014-06-20 19:00:56 +02:00
|
|
|
void sout_AnnounceUnRegister (vlc_object_t *obj, session_descriptor_t *session)
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
{
|
2008-09-11 19:36:52 +02:00
|
|
|
sap_address_t *addr, **paddr;
|
2014-06-20 18:34:45 +02:00
|
|
|
session_descriptor_t **psession;
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
|
2014-06-20 18:59:37 +02:00
|
|
|
msg_Dbg (obj, "removing SAP session");
|
2014-06-20 18:52:03 +02:00
|
|
|
vlc_mutex_lock (&sap_mutex);
|
2014-06-20 18:59:37 +02:00
|
|
|
paddr = &sap_addrs;
|
2014-06-20 18:34:45 +02:00
|
|
|
for (;;)
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
{
|
2014-06-20 18:34:45 +02:00
|
|
|
addr = *paddr;
|
|
|
|
assert (addr != NULL);
|
|
|
|
|
2008-09-11 19:36:52 +02:00
|
|
|
psession = &addr->first;
|
|
|
|
vlc_mutex_lock (&addr->lock);
|
2014-06-20 18:34:45 +02:00
|
|
|
while (*psession != NULL)
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
{
|
2014-06-20 18:34:45 +02:00
|
|
|
if (*psession == session)
|
2008-09-11 19:36:52 +02:00
|
|
|
goto found;
|
2014-06-20 18:34:45 +02:00
|
|
|
psession = &(*psession)->next;
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
}
|
2008-09-11 19:36:52 +02:00
|
|
|
vlc_mutex_unlock (&addr->lock);
|
|
|
|
paddr = &addr->next;
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
}
|
|
|
|
|
2008-09-11 19:36:52 +02:00
|
|
|
found:
|
|
|
|
*psession = session->next;
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
|
2008-09-11 19:36:52 +02:00
|
|
|
if (addr->first == NULL)
|
|
|
|
/* Last session for this address -> unlink the address */
|
|
|
|
*paddr = addr->next;
|
2014-06-20 18:52:03 +02:00
|
|
|
vlc_mutex_unlock (&sap_mutex);
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
|
2008-09-11 19:36:52 +02:00
|
|
|
if (addr->first == NULL)
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
{
|
2008-09-11 19:36:52 +02:00
|
|
|
/* Last session for this address -> unlink the address */
|
|
|
|
vlc_mutex_unlock (&addr->lock);
|
|
|
|
AddressDestroy (addr);
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
}
|
2008-09-11 19:36:52 +02:00
|
|
|
else
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
{
|
2008-09-11 19:36:52 +02:00
|
|
|
addr->session_count--;
|
|
|
|
vlc_cond_signal (&addr->wait);
|
|
|
|
vlc_mutex_unlock (&addr->lock);
|
* ALL: Better announce system
- The SAP handler now runs in a separate thread.
- RTP sessions can be announced with sap (sdp=sap://,name=...)
TODO: Make this more configurable
- Better SDP generation (the timestamp problem is not resolved)
About this, there is a problem : as, for a RTP session, the URI
is the complete SDP, if the session is recreated, as the URI has
changed, a new item is added to the playlist
- Experimental flow control algorithm :
It does not follow the "Recommended" implementation, as it needs
to count the sessions (to achieve this, we should make this work
together with the SAP listener)
It is disabled by default (use --sap-flow-control to enable).
When it is disabled, sap announcement interval is set by --sap-interval
* src/misc/net.c : created net_ReadNonBlock
* sap.c : Fixed memory problem
2004-04-18 20:21:09 +02:00
|
|
|
}
|
|
|
|
|
2017-05-29 17:36:54 +02:00
|
|
|
free(session->data);
|
|
|
|
free(session);
|
2014-06-20 17:33:30 +02:00
|
|
|
}
|