Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
a5a265ad
Commit
a5a265ad
authored
Apr 29, 2007
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Numerous compile fixes.
parent
1e9bb017
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
37 deletions
+67
-37
modules/mux/rtp/rtcp.c
modules/mux/rtp/rtcp.c
+51
-28
modules/mux/rtp/rtcp.h
modules/mux/rtp/rtcp.h
+16
-9
No files found.
modules/mux/rtp/rtcp.c
View file @
a5a265ad
/*****************************************************************************
* rtcp.c: RTP/RTCP source file
*****************************************************************************
* Copyright (C) 2005 M2X
* Copyright (C) 2005
-2007
M2X
*
* $Id$
*
...
...
@@ -33,15 +33,8 @@
#include "rtp.h"
#include "rtcp.h"
static
void
send_RTCP
(
vlc_object_t
*
p_this
,
rtcp_event_t
rtcp_event
)
{
/* FIXME: higher level functions that should be in another file */
}
static
void
rtcp_schedule
(
vlc_object_t
*
p_this
,
uint64_t
i_sched
,
rtcp_event_t
rtcp_event
)
{
/* FIXME: higher level functions that should be in another file */
}
void
send_RTCP
(
vlc_object_t
*
p_this
,
rtcp_event_t
);
void
rtcp_schedule
(
vlc_object_t
*
p_this
,
mtime_t
,
rtcp_event_t
);
/* SDES support functions */
static
int
SDES_client_item_add
(
rtcp_client_t
*
p_client
,
int
i_item
,
char
*
psz_name
)
...
...
@@ -50,7 +43,7 @@ static int SDES_client_item_add( rtcp_client_t *p_client, int i_item, char *psz_
p_item
=
(
rtcp_SDES_item_t
*
)
malloc
(
sizeof
(
rtcp_SDES_item_t
)
);
if
(
!
p_item
)
return
VLC_E
GENERIC
;
return
VLC_E
NOMEM
;
p_item
->
u_type
=
i_item
;
p_item
->
psz_data
=
strdup
(
psz_name
);
p_item
->
i_index
=
p_client
->
i_items
+
1
;;
...
...
@@ -83,7 +76,7 @@ int rtcp_add_client( vlc_object_t *p_this, uint32_t u_ssrc, uint32_t *i_pos )
vlc_mutex_lock
(
&
p_rtcp
->
object_lock
);
p_client
=
(
rtcp_client_t
*
)
malloc
(
sizeof
(
rtcp_client_t
)
);
if
(
!
p_client
)
return
VLC_E
GENERIC
;
return
VLC_E
NOMEM
;
p_client
->
i_index
=
p_rtcp
->
i_clients
+
1
;
p_client
->
b_deleted
=
VLC_FALSE
;
*
i_pos
=
p_client
->
i_index
;
...
...
@@ -109,6 +102,7 @@ int rtcp_del_client( vlc_object_t *p_this, uint32_t u_ssrc )
p_old
->
i_timeout
=
5
*
(
p_rtcp
->
i_date
-
p_rtcp
->
i_last_date
)
+
p_rtcp
->
i_next_date
;
p_rtcp
->
u_clients
--
;
/* BYE message is sent by rtcp_destroy_client() */
}
vlc_mutex_unlock
(
&
p_rtcp
->
object_lock
);
return
VLC_SUCCESS
;
...
...
@@ -138,6 +132,39 @@ int rtcp_cleanup_clients( vlc_object_t *p_this )
return
VLC_SUCCESS
;
}
/* Close communication with clients and release allocated objects */
int
rtcp_destroy_clients
(
vlc_object_t
*
p_this
)
{
rtcp_t
*
p_rtcp
=
(
rtcp_t
*
)
p_this
;
uint32_t
i
=
0
;
for
(
i
=
0
;
i
<
p_rtcp
->
i_clients
;
i
++
)
{
rtcp_pkt_t
*
pkt
=
NULL
;
rtcp_client_t
*
p_old
=
p_rtcp
->
pp_clients
[
i
];
p_rtcp
->
pf_del_client
(
p_this
,
p_old
->
u_ssrc
);
pkt
=
rtcp_pkt_new
(
p_this
,
RTCP_BYE
);
if
(
pkt
)
{
block_t
*
p_block
=
NULL
;
p_block
=
rtcp_encode_BYE
(
p_this
,
pkt
,
strdup
(
"server is leaving"
)
);
/* FIXME:
* if( p_block )
* send_RTCP( p_this, p_block );
*/
}
}
/* wait till all clients have been signalled */
while
(
p_rtcp
->
i_clients
!=
0
)
{
p_rtcp
->
pf_cleanup_clients
(
p_this
);
msleep
(
500
);
}
return
VLC_SUCCESS
;
}
/* rtcp_find_client should be called with the object lock held.
* vlc_mutex_lock( &p_rtcp->obj_lock );
*/
...
...
@@ -162,7 +189,7 @@ int rtcp_find_client( vlc_object_t *p_this, uint32_t u_ssrc, uint32_t *i_pos )
* rtcp_interval - Calculate the interval in seconds for sending RTCP packets.
*--------------------------------------------------------------------------
*/
uint64_t
rtcp_interval
(
vlc_object_t
*
p_this
,
uint64_t
u_bandwidth
,
uint64_t
rtcp_interval
(
vlc_object_t
*
p_this
,
uint64_t
u_bandwidth
,
uint32_t
u_ssrc
,
vlc_bool_t
b_sender
,
vlc_bool_t
b_first
)
{
rtcp_t
*
p_rtcp
=
(
rtcp_t
*
)
p_this
;
...
...
@@ -174,8 +201,6 @@ uint64_t rtcp_interval( vlc_object_t *p_this, uint64_t u_bandwidth,
double
i_interval
=
0
;
int
n
=
p_rtcp
->
i_clients
;
int
u_ssrc
=
0
;
/* FIXME: how to know which client we look for?? */
if
(
b_first
)
i_rtcp_min
=
(
i_rtcp_min
>>
1
);
...
...
@@ -194,8 +219,8 @@ uint64_t rtcp_interval( vlc_object_t *p_this, uint64_t u_bandwidth,
}
/* calculate average time between reports */
p_client
=
p_rtcp
->
pf_find_client
(
p_this
,
u_ssrc
,
&
i_pos
);
if
(
!
p_client
)
return
-
1
;
if
(
!
p_client
)
return
-
1
;
i_interval
=
p_client
->
p_stats
->
u_avg_pkt_size
*
(
n
/
i_bandwidth
);
if
(
i_interval
<
i_rtcp_min
)
...
...
@@ -210,23 +235,21 @@ uint64_t rtcp_interval( vlc_object_t *p_this, uint64_t u_bandwidth,
* rtcp_expire - decides to sent an RTCP report or a BYE record
*--------------------------------------------------------------------------
*/
void
rtcp_expire
(
vlc_object_t
*
p_this
,
rtcp_event_t
rtcp_event
,
uint64_t
u_bandwidth
,
vlc_bool_t
b_sender
,
vlc_bool_t
*
b_first
)
void
rtcp_expire
(
vlc_object_t
*
p_this
,
rtcp_event_t
rtcp_event
,
uint64_t
u_bandwidth
,
uint32_t
u_ssrc
,
vlc_bool_t
b_sender
,
vlc_bool_t
*
b_first
)
{
rtcp_t
*
p_rtcp
=
(
rtcp_t
*
)
p_this
;
rtcp_client_t
*
p_client
=
NULL
;
rtcp_client_t
*
p_client
=
NULL
;
rtcp_stats_t
*
p_stats
=
NULL
;
mtime_t
i_interval
=
0
;
uint32_t
i_pos
=
0
;
int
u_ssrc
=
0
;
/* FIXME: how to know which client we look for?? */
p_client
=
p_rtcp
->
pf_find_client
(
p_this
,
u_ssrc
,
&
i_pos
);
if
(
!
p_client
)
return
;
if
(
!
p_client
)
return
;
p_stats
=
(
rtcp_stats_t
*
)
p_client
->
p_stats
;
i_interval
=
(
mtime_t
)
rtcp_interval
(
p_this
,
u_bandwidth
,
b_sender
,
*
b_first
);
u_ssrc
,
b_sender
,
*
b_first
);
p_rtcp
->
i_next_date
=
p_rtcp
->
i_last_date
+
i_interval
;
switch
(
rtcp_event
)
...
...
@@ -254,7 +277,7 @@ void rtcp_expire( vlc_object_t *p_this, rtcp_event_t rtcp_event,
/* recalculate */
p_rtcp
->
i_last_date
=
p_rtcp
->
i_date
;
i_interval
=
rtcp_interval
(
p_this
,
u_bandwidth
,
b_sender
,
*
b_first
);
u_ssrc
,
b_sender
,
*
b_first
);
rtcp_schedule
(
p_this
,
p_rtcp
->
i_next_date
+
i_interval
,
rtcp_event
);
*
b_first
=
VLC_FALSE
;
}
...
...
@@ -989,7 +1012,7 @@ block_t *rtcp_encode_BYE( vlc_object_t *p_this, rtcp_pkt_t *p_pkt, char *psz_rea
block_t
*
p_block
=
NULL
;
uint32_t
i_count
=
strlen
(
psz_reason
);
uint8_t
u_octet
=
i_count
/
8
;
/* Octect count ??*/
u
int32_t
i_pos
,
i_pad
,
i_padding
;
int32_t
i_pos
,
i_pad
,
i_padding
;
if
(
p_pkt
->
u_payload_type
!=
RTCP_BYE
)
return
NULL
;
...
...
@@ -1012,7 +1035,7 @@ block_t *rtcp_encode_BYE( vlc_object_t *p_this, rtcp_pkt_t *p_pkt, char *psz_rea
/* Give reason for leaving */
//FIXME: bs_write( s, 8, p_item->u_type );
bs_write
(
s
,
8
,
u_octet
);
for
(
i_pos
=
0
;
i_pos
<
i_count
;
i_pos
++
)
{
/* FIXME: must be UTF 8 encoded */
...
...
modules/mux/rtp/rtcp.h
View file @
a5a265ad
/*****************************************************************************
* rtcp.h: RTP/RTCP headerfile
*****************************************************************************
* Copyright (C) 2005 M2X
* Copyright (C) 2005
-2007
M2X
*
* $Id$
*
...
...
@@ -144,6 +144,8 @@ typedef struct
typedef
struct
rtcp_client_t
{
int
fd
;
/*< socket descriptor of rtcp stream */
uint32_t
i_index
;
uint32_t
u_ssrc
;
/*< channel name */
vlc_bool_t
b_deleted
;
/*< channel deleted ? */
...
...
@@ -165,8 +167,6 @@ typedef struct rtcp_t
{
VLC_COMMON_MEMBERS
int
fd
;
/*< socket descriptor of rtcp stream */
uint32_t
u_clients
;
/*< number of clients connected */
uint32_t
u_active
;
/*< number of active senders */
uint32_t
u_members
;
/*< number of clients in previous interval */
...
...
@@ -182,17 +182,20 @@ typedef struct rtcp_t
/* bitstream data pointer used for decoding */
bs_t
*
bs
;
/*< bitstream decoding data pointer */
/* functions */
int
(
*
pf_add_client
)(
vlc_object_t
*
p_this
,
uint32_t
u_ssrc
,
uint32_t
*
i_pos
);
int
(
*
pf_del_client
)(
vlc_object_t
*
p_this
,
uint32_t
u_ssrc
);
int
(
*
pf_find_client
)(
vlc_object_t
*
p_this
,
uint32_t
u_ssrc
,
uint32_t
*
i_pos
);
int
(
*
pf_cleanup_clients
)(
vlc_object_t
*
p_this
);
int
(
*
pf_destroy_clients
)(
vlc_object_t
*
p_this
);
}
rtcp_t
;
int
rtcp_add_client
(
vlc_object_t
*
p_this
,
uint32_t
u_ssrc
,
uint32_t
*
i_pos
);
int
rtcp_del_client
(
vlc_object_t
*
p_this
,
uint32_t
u_ssrc
);
/* Should be called with vlc_mutex_lock( &p_this->objec_lock ) held */
int
rtcp_find_client
(
vlc_object_t
*
p_this
,
uint32_t
u_ssrc
,
uint32_t
*
i_pos
);
int
rtcp_cleanup_clients
(
vlc_object_t
*
p_this
);
int
rtcp_destroy_clients
(
vlc_object_t
*
p_this
);
/**
* rtcp_cleanup_clients - Permanently remove clients from the list
...
...
@@ -221,7 +224,7 @@ int rtcp_pkt_decode( vlc_object_t *p_this, rtcp_pkt_t *p_pkt, block_t *p_block )
/**
* rtcp_pkt_new - Encode RTCP packet
* Create a new RTCP packet of type 'type'
* Arguments
* Arguments
:
* \param type type of RTCP packet @see
*/
rtcp_pkt_t
*
rtcp_pkt_new
(
vlc_object_t
*
p_this
,
int
type
);
...
...
@@ -240,31 +243,35 @@ block_t *rtcp_encode_BYE( vlc_object_t *p_this, rtcp_pkt_t *p_pkt, char *psz_rea
* Arguments:
* \param p_this VLC_OBJECT of type rtcp_t
* \param u_bandwith bandwidth of RTP connection
* \param u_ssrc client to sent or receive from
* \param b_sender are we the sender or the receiver
* \param b_first the first time this function is called use only half
* of the initial waiting time
*/
uint64_t
rtcp_interval
(
vlc_object_t
*
p_this
,
uint64_t
u_bandwidth
,
uint64_t
rtcp_interval
(
vlc_object_t
*
p_this
,
uint64_t
u_bandwidth
,
uint32_t
u_ssrc
,
vlc_bool_t
b_sender
,
vlc_bool_t
b_first
);
/**
* rtcp_expire
* Decides to sent an RTCP report or a BYE record
* Arguments:
* \param p_this VLC_OBJECT of type rtcp_t
* \param u_bandwith bandwidth of RTP connection
* \param u_ssrc client to sent or receive from
* \param rtcp_event type of event received
* \param b_sender are we the sender or the receiver
* \param *b_first the first time this function is called use only half
* of the initial waiting time. If b_first is VLC_TRUE, then
* it will return *b_first = VLC_FALSE;
*/
void
rtcp_expire
(
vlc_object_t
*
p_this
,
rtcp_event_t
rtcp_event
,
uint64_t
u_bandwidth
,
vlc_bool_t
b_sender
,
vlc_bool_t
*
b_first
);
void
rtcp_expire
(
vlc_object_t
*
p_this
,
rtcp_event_t
rtcp_event
,
uint64_t
u_bandwidth
,
uint32_t
u_ssrc
,
vlc_bool_t
b_sender
,
vlc_bool_t
*
b_first
);
/**
* rtcp_received
* Determine what to do on the received Sender Report, decode it
* or leave the channel (BYE record).
* Arguments:
* \param p_this VLC_OBJECT of type rtcp_t
* \param p_pkt RTCP packet that was received
* \param rtcp_event type of event received
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment