Stats/events: identify by stream ID (host:port)

This commit is contained in:
Martin Pulec
2016-05-31 16:34:25 +02:00
parent 1d22ae2dd2
commit dde8a55a61
6 changed files with 14 additions and 12 deletions

View File

@@ -173,7 +173,7 @@ void state_transcoder_decompress::worker()
case message::FRAME:
for (unsigned int i = 0; i < output_ports.size(); ++i) {
if (output_ports[i].active)
recompress_process_async(output_ports[i].state, msg.frame, i);
recompress_process_async(output_ports[i].state, msg.frame);
}
break;
}

View File

@@ -67,6 +67,11 @@ void *recompress_init(struct module *parent,
try {
auto rxtx = video_rxtx::create("ultragrid_rtp", params);
if (strchr(host, ':') != NULL) {
rxtx->m_port_id = string("[") + host + "]:" + to_string(tx_port);
} else {
rxtx->m_port_id = string(host) + ":" + to_string(tx_port);
}
return new state_recompress(
decltype(state_recompress::video_rxtx)(dynamic_cast<ultragrid_rtp_video_rxtx *>(rxtx)),
@@ -78,7 +83,7 @@ void *recompress_init(struct module *parent,
}
}
void recompress_process_async(void *state, shared_ptr<video_frame> frame, int port_id)
void recompress_process_async(void *state, shared_ptr<video_frame> frame)
{
auto s = static_cast<state_recompress *>(state);
@@ -97,7 +102,6 @@ void recompress_process_async(void *state, shared_ptr<video_frame> frame, int po
s->frames = 0;
}
s->video_rxtx->m_port_id = port_id;
s->video_rxtx->send(frame);
}

View File

@@ -24,5 +24,6 @@ uint32_t recompress_get_ssrc(void *state);
#ifdef __cplusplus
#include <memory>
void recompress_process_async(void *state, std::shared_ptr<video_frame> frame, int port_id);
#include <string>
void recompress_process_async(void *state, std::shared_ptr<video_frame> frame);
#endif

View File

@@ -69,7 +69,7 @@
using namespace std;
video_rxtx::video_rxtx(map<string, param_u> const &params): m_port_id(-1), m_paused(params.at("paused").b),
video_rxtx::video_rxtx(map<string, param_u> const &params): m_port_id("default"), m_paused(params.at("paused").b),
m_report_paused_play(false), m_rxtx_mode(params.at("rxtx_mode").i),
m_parent(static_cast<struct module *>(params.at("parent").ptr)),
m_compression(nullptr),

View File

@@ -83,7 +83,7 @@ public:
}
virtual void join();
static video_rxtx *create(std::string const & name, std::map<std::string, param_u> const &);
int m_port_id;
std::string m_port_id;
protected:
video_rxtx(std::map<std::string, param_u> const &);
int check_sender_messages();

View File

@@ -211,20 +211,17 @@ after_send:
// report events and stats
auto new_desc = video_desc_from_frame(tx_frame.get());
if (new_desc != m_video_desc) {
control_report_event(m_control, (m_port_id != -1 ? (string("-") + to_string(m_port_id) + " ") : string("")) +
control_report_event(m_control, m_port_id + " " +
string("captured video changed - ") +
(string) new_desc);
m_video_desc = new_desc;
}
if (tx_frame->paused_play) {
control_report_event(m_control, (m_port_id != -1 ? (string("-") + to_string(m_port_id) + " ") : string("")) +
control_report_event(m_control, m_port_id + " " +
string("play"));
}
ostringstream oss;
if (m_port_id != -1) {
oss << "-" << m_port_id << " ";
}
oss << "bufferId " << buffer_id <<
oss << m_port_id << " bufferId " << buffer_id <<
" droppedFrames " << dropped_frames <<
" nanoPerFrameActual " << (m_nano_per_frame_actual_cumul += nano_actual) <<
" nanoPerFrameExpected " << (m_nano_per_frame_expected_cumul += nano_expected) <<