Skip to content

Commit

Permalink
Merge pull request IntelRealSense#31 from IntelRealSense/michalpr_tmp…
Browse files Browse the repository at this point in the history
…branch

Add a callback function in ip_device and rthernet_device
  • Loading branch information
michalprager authored Jan 13, 2020
2 parents 41a2233 + 89cb184 commit 0812779
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/ethernet/ethernet-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ std::mutex mtx;
rs2_stream_profile* depth_stream;
volatile bool is_active = false;

// michalpr - remove this. this is a workaround until callback branch will be merged
void ethernetDeviceFrameCallBack(u_int8_t* buf, unsigned int size, struct timeval presentationTime)
{
std::cout << "myFrameCallBack. size = " << size << " time (sec) = " << presentationTime.tv_sec << "\n";
}

char stop_flag = 0;
void sig_handler(int signo)
{
Expand Down Expand Up @@ -280,7 +286,7 @@ void rs2::ethernet_device::start(std::string url) {
{
if (rtsp_clients[i]==NULL)
continue;
rtsp_clients[i]->addStream(available_streams[i]);
rtsp_clients[i]->addStream(available_streams[i], &ethernetDeviceFrameCallBack);
rtsp_clients[i]->start();
}

Expand Down
8 changes: 7 additions & 1 deletion src/ethernet/ip_device.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#include "ip_device.hh"
#include <librealsense2/rs.hpp>

// michalpr - remove this. this is a workaround until callback branch will be merged
void ipDeviceFrameCallBack(u_int8_t* buf, unsigned int size, struct timeval presentationTime)
{
std::cout << "myFrameCallBack. size = " << size << " time (sec) = " << presentationTime.tv_sec << "\n";
}

ip_device::~ip_device()
{
is_device_alive = false;
Expand Down Expand Up @@ -126,7 +132,7 @@ void ip_device::update_sensor_stream(int sensor_index,std::vector<rs2::stream_pr

std::cout << "Starting new stream" << st.type << " " << st.fps << "\n" ;

rtsp_clients[sensor_index]->addStream(st);
rtsp_clients[sensor_index]->addStream(st, &ipDeviceFrameCallBack);
rtsp_clients[sensor_index]->start();
}
}
Expand Down

0 comments on commit 0812779

Please sign in to comment.