Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-apps-astreamer
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-apps-astreamer
Commits
58b954f2
Commit
58b954f2
authored
Mar 11, 2017
by
Mikhail Karpenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update debug macro in audio, fix debug macro in other modules
parent
7e9dba1a
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
133 additions
and
116 deletions
+133
-116
audio.cpp
src/audio.cpp
+106
-99
audio.h
src/audio.h
+7
-7
main.cpp
src/main.cpp
+2
-1
rtp_stream.cpp
src/rtp_stream.cpp
+3
-1
streamer.cpp
src/streamer.cpp
+10
-2
video.cpp
src/video.cpp
+5
-6
No files found.
src/audio.cpp
View file @
58b954f2
This diff is collapsed.
Click to expand it.
src/audio.h
View file @
58b954f2
...
@@ -40,7 +40,7 @@ using namespace std;
...
@@ -40,7 +40,7 @@ using namespace std;
class
Audio
:
public
RTP_Stream
{
class
Audio
:
public
RTP_Stream
{
public
:
public
:
Audio
(
bool
enable
,
Parameters
*
pars
,
int
sample_rate
=
SAMPLE_RATE
,
int
channels
=
SAMPLE_CHANNELS
);
Audio
(
int
port
,
bool
enable
,
Parameters
*
pars
,
int
sample_rate
=
SAMPLE_RATE
,
int
channels
=
SAMPLE_CHANNELS
);
virtual
~
Audio
(
void
);
virtual
~
Audio
(
void
);
long
sample_rate
(
void
)
{
return
_sample_rate
;
};
long
sample_rate
(
void
)
{
return
_sample_rate
;
};
long
channels
(
void
)
{
return
_channels
;
};
long
channels
(
void
)
{
return
_channels
;
};
...
@@ -51,11 +51,11 @@ public:
...
@@ -51,11 +51,11 @@ public:
void
Start
(
string
ip
,
long
port
,
int
ttl
=
-
1
);
void
Start
(
string
ip
,
long
port
,
int
ttl
=
-
1
);
void
Stop
(
void
);
void
Stop
(
void
);
protected
:
protected
:
int
fd
;
//
int fd;
snd_pcm_t
*
capture_handle
;
snd_pcm_t
*
capture_handle
;
// PCM handle, returned from snd_pcm_open
short
*
sbuffer
;
short
*
sbuffer
;
long
sbuffer_len
;
long
sbuffer_len
;
bool
_present
;
bool
_present
;
// flag indicating that audio interface has been initialized
long
_sample_rate
;
long
_sample_rate
;
long
_channels
;
long
_channels
;
long
_volume
;
long
_volume
;
...
@@ -67,8 +67,8 @@ protected:
...
@@ -67,8 +67,8 @@ protected:
uint64_t
timestamp_rtcp
;
uint64_t
timestamp_rtcp
;
long
delta_fpga_sys
;
// A/V clocks delta for RTCP
long
delta_fpga_sys
;
// A/V clocks delta for RTCP
bool
is_first
;
//
bool is_first;
bool
is_first2
;
//
bool is_first2;
};
};
#endif // _AUDIO__H_
#endif // _AUDIO__H_
src/main.cpp
View file @
58b954f2
...
@@ -73,7 +73,8 @@ int main(int argc, char *argv[]) {
...
@@ -73,7 +73,8 @@ int main(int argc, char *argv[]) {
cerr
<<
"|"
<<
(
*
it
).
first
<<
"| == |"
<<
(
*
it
).
second
<<
"|"
<<
endl
;
cerr
<<
"|"
<<
(
*
it
).
first
<<
"| == |"
<<
(
*
it
).
second
<<
"|"
<<
endl
;
}
}
for
(
int
i
=
0
;
i
<
SENSOR_PORTS
;
i
++
)
{
for
(
int
i
=
0
;
i
<
1
;
i
++
)
{
// for (int i = 0; i < SENSOR_PORTS; i++) {
pthread_attr_t
attr
;
pthread_attr_t
attr
;
cout
<<
"Start thread "
<<
i
<<
endl
;
cout
<<
"Start thread "
<<
i
<<
endl
;
streamers
[
i
]
=
new
Streamer
(
args
,
i
);
streamers
[
i
]
=
new
Streamer
(
args
,
i
);
...
...
src/rtp_stream.cpp
View file @
58b954f2
...
@@ -39,7 +39,7 @@ using namespace std;
...
@@ -39,7 +39,7 @@ using namespace std;
a; \
a; \
} while (0)
} while (0)
#else
#else
#define D(a)
#define D(
s_port,
a)
#endif
#endif
RTP_Stream
::
RTP_Stream
(
void
)
{
RTP_Stream
::
RTP_Stream
(
void
)
{
...
@@ -200,6 +200,8 @@ void RTP_Stream::rtcp_send_sr(void) {
...
@@ -200,6 +200,8 @@ void RTP_Stream::rtcp_send_sr(void) {
ul
=
htonl
(
rtp_octets
);
ul
=
htonl
(
rtp_octets
);
memcpy
((
void
*
)
&
packet
[
24
],
(
void
*
)
&
ul
,
4
);
memcpy
((
void
*
)
&
packet
[
24
],
(
void
*
)
&
ul
,
4
);
rtcp_socket
->
send
(
packet
,
packet_len
);
rtcp_socket
->
send
(
packet
,
packet_len
);
D
(
sensor_port
,
cerr
<<
"stream name: "
<<
stream_name
<<
", f_tv: "
<<
f_tv
.
tv_sec
<<
":"
<<
f_tv
.
tv_usec
<<
", timestamp: "
<<
timestamp
<<
endl
);
}
}
void
RTP_Stream
::
rtcp_send_sdes
(
void
)
{
void
RTP_Stream
::
rtcp_send_sdes
(
void
)
{
...
...
src/streamer.cpp
View file @
58b954f2
...
@@ -65,7 +65,7 @@ Streamer::Streamer(const map<string, string> &_args, int port_num) {
...
@@ -65,7 +65,7 @@ Streamer::Streamer(const map<string, string> &_args, int port_num) {
params
=
new
Parameters
(
sensor_port
);
params
=
new
Parameters
(
sensor_port
);
args
=
_args
;
args
=
_args
;
audio
=
NULL
;
audio
=
NULL
;
session
->
process_audio
=
fals
e
;
session
->
process_audio
=
tru
e
;
session
->
audio
.
sample_rate
=
0
;
session
->
audio
.
sample_rate
=
0
;
session
->
audio
.
channels
=
0
;
session
->
audio
.
channels
=
0
;
session
->
rtp_out
.
ip_custom
=
false
;
session
->
rtp_out
.
ip_custom
=
false
;
...
@@ -83,6 +83,13 @@ Streamer::Streamer(const map<string, string> &_args, int port_num) {
...
@@ -83,6 +83,13 @@ Streamer::Streamer(const map<string, string> &_args, int port_num) {
}
}
rtsp_server
=
NULL
;
rtsp_server
=
NULL
;
connected_count
=
0
;
connected_count
=
0
;
// DEBUG FEATURE: self-enable audio processing, this should be done elsewhere, probably from camvc
unsigned
long
snd_en
=
0
;
if
(
session
->
process_audio
)
snd_en
=
1
;
unsigned
long
params_array
[
2
]
=
{
P_STROP_AUDIO_EN
,
snd_en
};
params
->
setPValue
(
params_array
,
2
);
}
}
void
Streamer
::
audio_init
(
void
)
{
void
Streamer
::
audio_init
(
void
)
{
...
@@ -91,7 +98,7 @@ void Streamer::audio_init(void) {
...
@@ -91,7 +98,7 @@ void Streamer::audio_init(void) {
delete
audio
;
delete
audio
;
}
}
D
(
sensor_port
,
cout
<<
"audio_enabled == "
<<
session
->
process_audio
<<
endl
);
D
(
sensor_port
,
cout
<<
"audio_enabled == "
<<
session
->
process_audio
<<
endl
);
audio
=
new
Audio
(
session
->
process_audio
,
params
,
session
->
audio
.
sample_rate
,
session
->
audio
.
channels
);
audio
=
new
Audio
(
se
nsor_port
,
se
ssion
->
process_audio
,
params
,
session
->
audio
.
sample_rate
,
session
->
audio
.
channels
);
if
(
audio
->
present
()
&&
session
->
process_audio
)
{
if
(
audio
->
present
()
&&
session
->
process_audio
)
{
session
->
process_audio
=
true
;
session
->
process_audio
=
true
;
session
->
audio
.
type
=
audio
->
ptype
();
session
->
audio
.
type
=
audio
->
ptype
();
...
@@ -271,6 +278,7 @@ int Streamer::update_settings(bool apply) {
...
@@ -271,6 +278,7 @@ int Streamer::update_settings(bool apply) {
f_audio_channels
=
true
;
f_audio_channels
=
true
;
if
((
audio_proc
||
session
->
process_audio
)
&&
(
f_audio_rate
||
f_audio_channels
))
if
((
audio_proc
||
session
->
process_audio
)
&&
(
f_audio_rate
||
f_audio_channels
))
audio_was_changed
=
true
;
audio_was_changed
=
true
;
D
(
sensor_port
,
cerr
<<
"audio_proc = "
<<
audio_proc
<<
", process_audio = "
<<
session
->
process_audio
<<
", f_audio_rate = "
<<
f_audio_rate
<<
"f_audio_channels = "
<<
f_audio_channels
<<
endl
);
if
(
apply
)
{
if
(
apply
)
{
bool
audio_restarted
=
false
;
bool
audio_restarted
=
false
;
if
(
audio_was_changed
)
{
if
(
audio_was_changed
)
{
...
...
src/video.cpp
View file @
58b954f2
...
@@ -40,10 +40,10 @@ using namespace std;
...
@@ -40,10 +40,10 @@ using namespace std;
//#undef VIDEO_DEBUG
//#undef VIDEO_DEBUG
//#undef VIDEO_DEBUG_2 // for timestamp monitoring
//#undef VIDEO_DEBUG_2 // for timestamp monitoring
//
#undef VIDEO_DEBUG_3 // for FPS monitoring
#undef VIDEO_DEBUG_3 // for FPS monitoring
#define VIDEO_DEBUG
#define VIDEO_DEBUG
#define VIDEO_DEBUG_2 // for timestamp monitoring
#define VIDEO_DEBUG_2 // for timestamp monitoring
#define VIDEO_DEBUG_3 // for FPS monitoring
//
#define VIDEO_DEBUG_3 // for FPS monitoring
#ifdef VIDEO_DEBUG
#ifdef VIDEO_DEBUG
#define D(s_port, a) \
#define D(s_port, a) \
...
@@ -52,7 +52,7 @@ using namespace std;
...
@@ -52,7 +52,7 @@ using namespace std;
a; \
a; \
} while (0)
} while (0)
#else
#else
#define D(a)
#define D(
s_port,
a)
#endif
#endif
#ifdef VIDEO_DEBUG_2
#ifdef VIDEO_DEBUG_2
...
@@ -62,7 +62,7 @@ using namespace std;
...
@@ -62,7 +62,7 @@ using namespace std;
a; \
a; \
} while (0)
} while (0)
#else
#else
#define D2(a)
#define D2(
s_port,
a)
#endif
#endif
#ifdef VIDEO_DEBUG_3
#ifdef VIDEO_DEBUG_3
...
@@ -72,7 +72,7 @@ using namespace std;
...
@@ -72,7 +72,7 @@ using namespace std;
a; \
a; \
} while (0)
} while (0)
#else
#else
#define D3(a)
#define D3(
s_port,
a)
#endif
#endif
/** The length of interframe parameters in bytes */
/** The length of interframe parameters in bytes */
...
@@ -459,7 +459,6 @@ long Video::capture(void) {
...
@@ -459,7 +459,6 @@ long Video::capture(void) {
// read Q value
// read Q value
get_frame_pars
(
fp
,
latestAvailableFrame_ptr
);
get_frame_pars
(
fp
,
latestAvailableFrame_ptr
);
D3
(
sensor_port
,
cerr
<<
"fp->signffff "
<<
fp
->
signffff
<<
endl
);
// See if the frame parameters are the same as were used when starting the stream,
// See if the frame parameters are the same as were used when starting the stream,
// otherwise check for up to G_SKIP_DIFF_FRAME older frames and return them instead.
// otherwise check for up to G_SKIP_DIFF_FRAME older frames and return them instead.
...
...
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