Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
mediastreamer2
Commits
030250c1
Commit
030250c1
authored
Aug 25, 2010
by
Simon Morlat
Browse files
do not assume samplerate=clockrate (because g722)
parent
6cc9076b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
13 deletions
+32
-13
build/win32native/Makefile.am
build/win32native/Makefile.am
+1
-1
src/audiostream.c
src/audiostream.c
+9
-4
src/msrtp.c
src/msrtp.c
+22
-8
No files found.
build/win32native/Makefile.am
View file @
030250c1
EXTRA_DIST
=
alldescs.h mediastreamer2.vcproj
mediastream.vcproj
videodisplay.vcproj mediastreamer2.def
EXTRA_DIST
=
alldescs.h mediastreamer2.vcproj videodisplay.vcproj mediastreamer2.def
src/audiostream.c
View file @
030250c1
...
...
@@ -206,7 +206,6 @@ static void payload_type_changed(RtpSession *session, unsigned long data){
audio_stream_change_decoder
(
stream
,
pt
);
}
int
audio_stream_start_full
(
AudioStream
*
stream
,
RtpProfile
*
profile
,
const
char
*
remip
,
int
remport
,
int
rem_rtcp_port
,
int
payload
,
int
jitt_comp
,
const
char
*
infile
,
const
char
*
outfile
,
MSSndCard
*
playcard
,
MSSndCard
*
captcard
,
bool_t
use_ec
)
...
...
@@ -215,6 +214,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
PayloadType
*
pt
;
int
tmp
;
MSConnectionHelper
h
;
int
sample_rate
;
rtp_session_set_profile
(
rtps
,
profile
);
if
(
remport
>
0
)
rtp_session_set_remote_addr_full
(
rtps
,
remip
,
remport
,
rem_rtcp_port
);
...
...
@@ -250,6 +250,11 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
ms_error
(
"audiostream.c: undefined payload type."
);
return
-
1
;
}
if
(
ms_filter_call_method
(
stream
->
rtpsend
,
MS_FILTER_GET_SAMPLE_RATE
,
&
sample_rate
)
!=
0
){
ms_error
(
"Sample rate is unknown for RTP side !"
);
return
-
1
;
}
stream
->
encoder
=
ms_filter_create_encoder
(
pt
->
mime_type
);
stream
->
decoder
=
ms_filter_create_decoder
(
pt
->
mime_type
);
if
((
stream
->
encoder
==
NULL
)
||
(
stream
->
decoder
==
NULL
)){
...
...
@@ -283,12 +288,12 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
}
/* give the sound filters some properties */
if
(
ms_filter_call_method
(
stream
->
soundread
,
MS_FILTER_SET_SAMPLE_RATE
,
&
pt
->
clock
_rate
)
!=
0
)
{
if
(
ms_filter_call_method
(
stream
->
soundread
,
MS_FILTER_SET_SAMPLE_RATE
,
&
sample
_rate
)
!=
0
)
{
/* need to add resampler*/
if
(
stream
->
read_resampler
==
NULL
)
stream
->
read_resampler
=
ms_filter_new
(
MS_RESAMPLE_ID
);
}
if
(
ms_filter_call_method
(
stream
->
soundwrite
,
MS_FILTER_SET_SAMPLE_RATE
,
&
pt
->
clock
_rate
)
!=
0
)
{
if
(
ms_filter_call_method
(
stream
->
soundwrite
,
MS_FILTER_SET_SAMPLE_RATE
,
&
sample
_rate
)
!=
0
)
{
/* need to add resampler*/
if
(
stream
->
write_resampler
==
NULL
)
stream
->
write_resampler
=
ms_filter_new
(
MS_RESAMPLE_ID
);
}
...
...
@@ -299,7 +304,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
/*configure the echo canceller if required */
if
(
use_ec
)
{
stream
->
ec
=
ms_filter_new
(
MS_SPEEX_EC_ID
);
ms_filter_call_method
(
stream
->
ec
,
MS_FILTER_SET_SAMPLE_RATE
,
&
pt
->
clock
_rate
);
ms_filter_call_method
(
stream
->
ec
,
MS_FILTER_SET_SAMPLE_RATE
,
&
sample
_rate
);
if
(
stream
->
ec_tail_len
!=
0
)
ms_filter_call_method
(
stream
->
ec
,
MS_ECHO_CANCELLER_SET_TAIL_LENGTH
,
&
stream
->
ec_tail_len
);
if
(
stream
->
ec_delay
!=
0
){
...
...
src/msrtp.c
View file @
030250c1
...
...
@@ -104,9 +104,7 @@ static int sender_set_session(MSFilter * f, void *arg)
rtp_profile_get_payload
(
rtp_session_get_profile
(
s
),
rtp_session_get_send_payload_type
(
s
));
if
(
pt
!=
NULL
)
{
if
(
strcasecmp
(
"g722"
,
pt
->
mime_type
)
==
0
)
d
->
rate
=
8000
;
else
d
->
rate
=
pt
->
clock_rate
;
d
->
rate
=
pt
->
clock_rate
;
}
else
{
ms_warning
(
"Sending undefined payload type ?"
);
}
...
...
@@ -141,7 +139,22 @@ static int sender_set_relay_session_id(MSFilter *f, void*arg){
static
int
sender_get_sr
(
MSFilter
*
f
,
void
*
arg
){
SenderData
*
d
=
(
SenderData
*
)
f
->
data
;
*
(
int
*
)
arg
=
d
->
rate
;
PayloadType
*
pt
;
if
(
d
->
session
==
NULL
)
{
ms_warning
(
"Could not obtain sample rate, session is not set."
);
return
-
1
;
}
pt
=
rtp_profile_get_payload
(
rtp_session_get_profile
(
d
->
session
),
rtp_session_get_recv_payload_type
(
d
->
session
));
if
(
pt
!=
NULL
)
{
if
(
strcasecmp
(
pt
->
mime_type
,
"G722"
)
==
0
)
*
(
int
*
)
arg
=
16000
;
else
*
(
int
*
)
arg
=
pt
->
clock_rate
;
}
else
{
ms_warning
(
"MSRtpSend: Could not obtain sample rate, payload type is unknown."
);
return
-
1
;
}
return
0
;
}
...
...
@@ -415,9 +428,7 @@ static int receiver_set_session(MSFilter * f, void *arg)
rtp_session_get_recv_payload_type
(
s
));
if
(
pt
!=
NULL
)
{
if
(
strcasecmp
(
"g722"
,
pt
->
mime_type
)
==
0
)
d
->
rate
=
8000
;
else
d
->
rate
=
pt
->
clock_rate
;
d
->
rate
=
pt
->
clock_rate
;
}
else
{
ms_warning
(
"Receiving undefined payload type %i ?"
,
rtp_session_get_recv_payload_type
(
s
));
...
...
@@ -437,7 +448,10 @@ static int receiver_get_sr(MSFilter *f, void *arg){
pt
=
rtp_profile_get_payload
(
rtp_session_get_profile
(
d
->
session
),
rtp_session_get_recv_payload_type
(
d
->
session
));
if
(
pt
!=
NULL
)
{
*
(
int
*
)
arg
=
pt
->
clock_rate
;
if
(
strcasecmp
(
pt
->
mime_type
,
"G722"
)
==
0
)
*
(
int
*
)
arg
=
16000
;
else
*
(
int
*
)
arg
=
pt
->
clock_rate
;
}
else
{
ms_warning
(
"Could not obtain sample rate, payload type is unknown."
);
return
-
1
;
...
...
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