Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
9ffa2604
Commit
9ffa2604
authored
Aug 24, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/raop: make some allocations static
Allocate objects on the stack to reduce heap overhead.
parent
03b1fad4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
29 deletions
+29
-29
raop_output_plugin.c
src/output/raop_output_plugin.c
+29
-29
No files found.
src/output/raop_output_plugin.c
View file @
9ffa2604
...
...
@@ -725,16 +725,18 @@ rtspcl_setup(struct rtspcl_data *rtspcld, struct key_data **kd)
char
*
token
,
*
pc
;
int
rval
=
false
;
buf
=
(
char
*
)
malloc
(
256
);
sprintf
(
buf
,
"RTP/AVP/UDP;unicast;interleaved=0-1;mode=record;control_port=%d;timing_port=%d"
,
raop_session
->
ctrl
.
port
,
raop_session
->
ntp
.
port
);
static
char
transport_key
[]
=
"Transport"
;
hds
.
key
=
strdup
(
"Transport"
);
hds
.
data
=
buf
;
char
transport_value
[
256
];
snprintf
(
transport_value
,
sizeof
(
transport_value
),
"RTP/AVP/UDP;unicast;interleaved=0-1;mode=record;control_port=%d;timing_port=%d"
,
raop_session
->
ctrl
.
port
,
raop_session
->
ntp
.
port
);
hds
.
key
=
transport_key
;
hds
.
data
=
transport_value
;
hds
.
next
=
NULL
;
buf
=
NULL
;
if
(
!
exec_request
(
rtspcld
,
"SETUP"
,
NULL
,
NULL
,
1
,
&
hds
,
&
rkd
))
return
false
;
free
(
hds
.
key
);
free
(
hds
.
data
);
if
(
!
(
rtspcld
->
session
=
strdup
(
kd_lookup
(
rkd
,
"Session"
))))
{
g_warning
(
"%s: no session in response
\n
"
,
__func__
);
goto
erexit
;
...
...
@@ -784,28 +786,29 @@ rtspcl_setup(struct rtspcl_data *rtspcld, struct key_data **kd)
static
bool
rtspcl_record
(
struct
rtspcl_data
*
rtspcld
)
{
struct
key_data
*
kdRange
,
*
kdRtp
;
int
rval
;
char
*
buf
=
(
char
*
)
malloc
(
128
);
if
(
!
rtspcld
->
session
)
{
g_warning
(
"%s: no session in progress
\n
"
,
__func__
);
free
(
buf
);
return
false
;
}
char
buf
[
128
];
sprintf
(
buf
,
"seq=%d,rtptime=%u"
,
raop_session
->
play_state
.
seq_num
,
raop_session
->
play_state
.
rtptime
);
kdRange
=
malloc
(
sizeof
(
struct
key_data
));
kdRtp
=
malloc
(
sizeof
(
struct
key_data
));
kdRange
->
key
=
strdup
(
"Range"
);
kdRange
->
data
=
strdup
(
"npt=0-"
);
kdRange
->
next
=
kdRtp
;
kdRtp
->
key
=
strdup
(
"RTP-Info"
);
kdRtp
->
data
=
buf
;
kdRtp
->
next
=
NULL
;
rval
=
exec_request
(
rtspcld
,
"RECORD"
,
NULL
,
NULL
,
1
,
kdRange
,
&
rtspcld
->
kd
);
free_kd
(
kdRange
);
return
rval
;
struct
key_data
rtp
;
static
char
rtp_key
[]
=
"RTP-Info"
;
rtp
.
key
=
rtp_key
;
rtp
.
data
=
buf
;
rtp
.
next
=
NULL
;
struct
key_data
range
;
static
char
range_key
[]
=
"Range"
;
range
.
key
=
range_key
;
static
char
range_value
[]
=
"npt=0-"
;
range
.
data
=
range_value
;
range
.
next
=
&
rtp
;
return
exec_request
(
rtspcld
,
"RECORD"
,
NULL
,
NULL
,
1
,
&
range
,
&
rtspcld
->
kd
);
}
static
bool
...
...
@@ -1189,7 +1192,6 @@ raop_output_cancel(void *data)
//flush
struct
key_data
kd
;
struct
raop_data
*
rd
=
(
struct
raop_data
*
)
data
;
char
*
buf
;
int
flush_diff
=
1
;
rd
->
started
=
0
;
...
...
@@ -1200,16 +1202,14 @@ raop_output_cancel(void *data)
return
;
}
buf
=
malloc
(
128
);
g_mutex_lock
(
rd
->
control_mutex
);
kd
.
key
=
strdup
(
"RTP-Info"
);
static
char
rtp_key
[]
=
"RTP-Info"
;
kd
.
key
=
rtp_key
;
char
buf
[
128
];
sprintf
(
buf
,
"seq=%d; rtptime=%d"
,
raop_session
->
play_state
.
seq_num
+
flush_diff
,
raop_session
->
play_state
.
rtptime
+
NUMSAMPLES
*
flush_diff
);
kd
.
data
=
buf
;
kd
.
next
=
NULL
;
exec_request
(
rd
->
rtspcl
,
"FLUSH"
,
NULL
,
NULL
,
1
,
&
kd
,
&
(
rd
->
rtspcl
->
kd
));
free
(
kd
.
key
);
free
(
kd
.
data
);
g_mutex_unlock
(
rd
->
control_mutex
);
}
...
...
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