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
7fc7b08f
Commit
7fc7b08f
authored
Jul 12, 2013
by
Simon Morlat
Browse files
improve a bit the pcap file player
parent
7d935deb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
2 deletions
+10
-2
configure.ac
configure.ac
+2
-1
src/audiofilters/msfileplayer.c
src/audiofilters/msfileplayer.c
+7
-0
tools/pcap_playback.c
tools/pcap_playback.c
+1
-1
No files found.
configure.ac
View file @
7fc7b08f
...
...
@@ -822,10 +822,11 @@ if test x$enable_pcap == xyes ; then
if test $PCAP != false ; then
PCAP_LIBS=`pcap-config --libs`
PCAP_CFLAGS=`pcap-config --cflags`
PCAP_CFLAGS="$PCAP_CFLAGS -DHAVE_PCAP"
AC_SUBST(PCAP_LIBS)
AC_SUBST(PCAP_CFLAGS)
AC_DEFINE(HAVE_PCAP,1,[whether we compile with libpcap support])
fi
fi
...
...
src/audiofilters/msfileplayer.c
View file @
7fc7b08f
...
...
@@ -302,6 +302,7 @@ static void player_process(MSFilter *f){
ms_filter_notify_no_arg
(
f
,
MS_FILE_PLAYER_EOF
);
}
else
if
(
res
>
0
)
{
const
u_char
*
ethernet_header
=
&
d
->
pcap_data
[
0
];
//const u_char *ip_header = ethernet_header; //use this line instead of the next one in case of wireshark capture without link layer*/
const
u_char
*
ip_header
=
ethernet_header
+
14
;
// sizeof(ethernet_header)
const
u_char
*
udp_header
=
ip_header
+
20
;
// sizeof(ipv4_header)
const
u_char
*
rtp_header
=
udp_header
+
8
;
// sizeof(udp_header)
...
...
@@ -314,20 +315,26 @@ static void player_process(MSFilter *f){
uint16_t
pcap_seq
=
ntohs
(
*
((
uint16_t
*
)(
rtp_header
+
2
)));
uint32_t
ts
=
ntohl
(
*
((
uint32_t
*
)(
rtp_header
+
4
)));
uint32_t
diff_ms
;
bool_t
markbit
=
rtp_header
[
1
]
>>
7
;
if
(
d
->
pcap_started
==
FALSE
)
{
d
->
pcap_started
=
TRUE
;
d
->
pcap_initial_ts
=
ts
;
d
->
pcap_initial_time
=
f
->
ticker
->
time
;
d
->
pcap_seq
=
pcap_seq
;
ms_message
(
"initial ts=%u, seq=%u"
,
ts
,
pcap_seq
);
}
diff_ms
=
((
ts
-
d
->
pcap_initial_ts
)
*
1000
)
/
d
->
rate
;
ms_message
(
"diff_ms=%u"
,
diff_ms
);
if
((
f
->
ticker
->
time
-
d
->
pcap_initial_time
)
>=
diff_ms
)
{
if
(
pcap_seq
>=
d
->
pcap_seq
)
{
om
=
allocb
(
bytes
,
0
);
memcpy
(
om
->
b_wptr
,
payload
,
bytes
);
om
->
b_wptr
+=
bytes
;
mblk_set_timestamp_info
(
om
,
f
->
ticker
->
time
);
mblk_set_marker_info
(
om
,
markbit
);
ms_queue_put
(
f
->
outputs
[
0
],
om
);
ms_message
(
"Outputting RTP packet of size %i, markbit=%i"
,
bytes
,(
int
)
markbit
);
}
d
->
pcap_seq
=
pcap_seq
;
d
->
pcap_hdr
=
NULL
;
...
...
tools/pcap_playback.c
View file @
7fc7b08f
...
...
@@ -221,8 +221,8 @@ static void setup_media_streams(MediastreamDatas *args)
args
->
decoder
=
ms_filter_create_decoder
(
args
->
pt
->
mime_type
);
ms_filter_call_method_noarg
(
args
->
read
,
MS_FILE_PLAYER_CLOSE
);
ms_filter_call_method
(
args
->
read
,
MS_FILE_PLAYER_OPEN
,
args
->
infile
);
ms_filter_call_method_noarg
(
args
->
read
,
MS_FILE_PLAYER_START
);
ms_filter_call_method
(
args
->
read
,
MS_FILTER_SET_SAMPLE_RATE
,
&
args
->
pt
->
clock_rate
);
ms_filter_call_method_noarg
(
args
->
read
,
MS_FILE_PLAYER_START
);
ms_filter_set_notify_callback
(
args
->
read
,
reader_notify_cb
,
NULL
);
/*force the decoder to output YUV420P */
...
...
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