Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live555 version freeze. #8282

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/ethernet/ip_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,9 @@ void ip_device::inject_frames_loop(std::shared_ptr<rs_rtp_stream> rtp_stream)

rtp_stream.get()->frame_data_buff.frame_number = 0;

/// FIXME: bbp and stride should be filled by m_rs_stream. but There are something wrong in m_rs_stream.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep this workaround until fix get_stride_in_bytes and get_bytes_per_pixel for Y8 image.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally agree with you, but there is one issue. We are trying to keep the network extensions library "external" to the main librealsense code. It means we cannot use "librealsense" namespace and we do use include files from the "src" directory. I will think about the solution for this issue. Any suggestions are welcome.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Thank you.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, these code should be moved to rs_rtp_stream::rs_rtp_stream() method. /src/ethernet/rs_rtp_stream.hh

rtp_stream->frame_data_buff.bpp = librealsense::get_image_bpp(rtp_stream.get()->get_stream_profile().format()) / 8;
rtp_stream->frame_data_buff.stride = rtp_stream->frame_data_buff.bpp * rtp_stream->m_rs_stream.width;

rtp_stream->frame_data_buff.bpp = getStreamProfileBpp(rtp_stream.get()->get_stream_profile().format());
rtp_stream->frame_data_buff.stride = rtp_stream->frame_data_buff.bpp * rtp_stream->m_rs_stream.width;

int uid = rtp_stream.get()->m_rs_stream.uid;
rs2_stream type = rtp_stream.get()->m_rs_stream.type;
int sensor_id = stream_type_to_sensor_id(type);
Expand Down
25 changes: 25 additions & 0 deletions src/ipDeviceCommon/RsCommon.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2020 Intel Corporation. All Rights Reserved.

#include "RsCommon.h"

int getStreamProfileBpp(rs2_format t_format) {
switch(t_format) {
case RS2_FORMAT_RGB8:
case RS2_FORMAT_BGR8:
return 3;
case RS2_FORMAT_RGBA8:
case RS2_FORMAT_BGRA8:
return 4;
case RS2_FORMAT_Z16:
case RS2_FORMAT_Y16:
case RS2_FORMAT_RAW16:
case RS2_FORMAT_YUYV:
case RS2_FORMAT_UYVY:
return 2;
case RS2_FORMAT_Y8:
return 1;
default:
return 0;
}
}
2 changes: 2 additions & 0 deletions src/ipDeviceCommon/RsCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,6 @@ const int MAX_MESSAGE_SIZE = MAX_FRAME_SIZE + sizeof(RsFrameHeader);
const unsigned int SDP_MAX_LINE_LENGHT = 4000;
const unsigned int RTP_TIMESTAMP_FREQ = 90000;

int getStreamProfileBpp(rs2_format t_format);

#pragma pack(pop)
13 changes: 11 additions & 2 deletions third-party/live555/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
cmake_minimum_required(VERSION 2.8.2)
project(live-download NONE)

set(live_file "${CMAKE_BINARY_DIR}/third-party/live555/live555-latest.tar.gz")
set(live_file "${CMAKE_SOURCE_DIR}/third-party/live555/live555-latest.tar.gz")

function(remote_source url)
if (EXISTS ${live_file})
message(STATUS "LIVE555: File exists, delete it to download again (${live_file})")
message(STATUS "LIVE555: File exists, delete it to download the latest version (${live_file})")
else()
message(STATUS "LIVE555: Downloading ${url}, this could take up to 3 min ")
message(STATUS "LIVE555: ")
message(STATUS "LIVE555: WARNING!WARNING!WARNING!WARNING!WARNING!WARNING ")
message(STATUS "LIVE555: ")
message(STATUS "LIVE555: This version might break the existing API ")
message(STATUS "LIVE555: !! Be sure to know what you are doing !! ")
message(STATUS "LIVE555: ")
message(STATUS "LIVE555: WARNING!WARNING!WARNING!WARNING!WARNING!WARNING ")
message(STATUS "LIVE555: ")

file(DOWNLOAD ${url} ${live_file} LOG log STATUS status TIMEOUT 180 SHOW_PROGRESS)
list(GET status 0 error_code)
if (NOT ${error_code} EQUAL 0)
Expand Down
Binary file added third-party/live555/live555-latest.tar.gz
Binary file not shown.
12 changes: 6 additions & 6 deletions tools/rs-server/RsRTSPServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@

RsRTSPServer* RsRTSPServer::createNew(UsageEnvironment& t_env, std::shared_ptr<RsDevice> t_device, Port t_ourPort, UserAuthenticationDatabase* t_authDatabase, unsigned t_reclamationSeconds)
{
int ourSocketIPv4 = setUpOurSocket(t_env, t_ourPort, AF_INET);
int ourSocketIPv6 = setUpOurSocket(t_env, t_ourPort, AF_INET6);
if (ourSocketIPv4 < 0 && ourSocketIPv6 < 0) return NULL;
int ourSocket = setUpOurSocket(t_env, t_ourPort);
if(ourSocket == -1)
return NULL;

return new RsRTSPServer(t_env, t_device, ourSocketIPv4, ourSocketIPv6, t_ourPort, t_authDatabase, t_reclamationSeconds);
return new RsRTSPServer(t_env, t_device, ourSocket, t_ourPort, t_authDatabase, t_reclamationSeconds);
}

RsRTSPServer::RsRTSPServer(UsageEnvironment& t_env, std::shared_ptr<RsDevice> t_device, int t_ourSocketIPv4, int t_ourSocketIPv6, Port t_ourPort, UserAuthenticationDatabase* t_authDatabase, unsigned t_reclamationSeconds)
: RTSPServer(t_env, t_ourSocketIPv4, t_ourSocketIPv6, t_ourPort, t_authDatabase, t_reclamationSeconds)
RsRTSPServer::RsRTSPServer(UsageEnvironment& t_env, std::shared_ptr<RsDevice> t_device, int t_ourSocket, Port t_ourPort, UserAuthenticationDatabase* t_authDatabase, unsigned t_reclamationSeconds)
: RTSPServer(t_env, t_ourSocket, t_ourPort, t_authDatabase, t_reclamationSeconds)
, m_device(t_device)
{}

Expand Down
2 changes: 1 addition & 1 deletion tools/rs-server/RsRTSPServer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public:
void setSupportedOptions(std::string t_key, std::vector<RsOption> t_supportedOptions);

protected:
RsRTSPServer(UsageEnvironment& t_env, std::shared_ptr<RsDevice> t_device, int t_ourSocketIPv4, int t_ourSocketIPv6, Port t_ourPort, UserAuthenticationDatabase* t_authDatabase, unsigned t_reclamationSeconds);
RsRTSPServer(UsageEnvironment& t_env, std::shared_ptr<RsDevice> t_device, int t_ourSocket, Port t_ourPort, UserAuthenticationDatabase* t_authDatabase, unsigned t_reclamationSeconds);
virtual ~RsRTSPServer();
char const* allowedCommandNames();

Expand Down
50 changes: 2 additions & 48 deletions tools/rs-server/RsSensor.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2020 Intel Corporation. All Rights Reserved.

#include "RsCommon.h"
#include "RsDevice.hh"
#include "RsUsageEnvironment.h"
#include "compression/CompressionFactory.h"
Expand Down Expand Up @@ -38,7 +39,7 @@ int RsSensor::open(std::unordered_map<long long int, rs2::frame_queue>& t_stream
if(CompressionFactory::isCompressionSupported(m_streamProfiles.at(streamProfileKey).format(), m_streamProfiles.at(streamProfileKey).stream_type()))
{
rs2::video_stream_profile vsp = m_streamProfiles.at(streamProfileKey);
std::shared_ptr<ICompression> compressPtr = CompressionFactory::getObject(vsp.width(), vsp.height(), vsp.format(), vsp.stream_type(), RsSensor::getStreamProfileBpp(vsp.format()));
std::shared_ptr<ICompression> compressPtr = CompressionFactory::getObject(vsp.width(), vsp.height(), vsp.format(), vsp.stream_type(), getStreamProfileBpp(vsp.format()));
if(compressPtr != nullptr)
{
m_iCompress.insert(std::pair<long long int, std::shared_ptr<ICompression>>(streamProfileKey, compressPtr));
Expand Down Expand Up @@ -125,48 +126,6 @@ std::string RsSensor::getSensorName()
}
}

int RsSensor::getStreamProfileBpp(rs2_format t_format)
{
int bpp = 0;
switch(t_format)
{
case RS2_FORMAT_RGB8:
{
bpp = 3;
break;
}
case RS2_FORMAT_BGR8:
{
bpp = 3;
break;
}
case RS2_FORMAT_RGBA8:
{
bpp = 3; //TODO: need to be 4 bpp, change it after add support for 4 bpp formats
break;
}
case RS2_FORMAT_BGRA8:
{
bpp = 3; //TODO: need to be 4 bpp, change it after add support for 4 bpp formats
break;
}
case RS2_FORMAT_Z16:
case RS2_FORMAT_Y16:
case RS2_FORMAT_Y8:
case RS2_FORMAT_RAW16:
case RS2_FORMAT_YUYV:
case RS2_FORMAT_UYVY:
{
bpp = 2;
break;
}
default:
bpp = 0;
break;
}
return bpp;
}

std::vector<RsOption> RsSensor::getSupportedOptions()
{
std::vector<RsOption> returnedVector;
Expand All @@ -182,11 +141,6 @@ std::vector<RsOption> RsSensor::getSupportedOptions()
RsOption option;
option.m_opt = opt;
option.m_range = m_sensor.get_option_range(opt);

/// FIXME: the default value for some option is invalid
if (option.m_range.def < option.m_range.min) option.m_range.def = option.m_range.min;
if (option.m_range.def > option.m_range.max) option.m_range.def = option.m_range.max;

returnedVector.push_back(option);
}
}
Expand Down
1 change: 0 additions & 1 deletion tools/rs-server/RsSensor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public:
}
static long long int getStreamProfileKey(rs2::stream_profile t_profile);
std::string getSensorName();
static int getStreamProfileBpp(rs2_format t_format);
rs2::device getDevice()
{
return m_device;
Expand Down
2 changes: 1 addition & 1 deletion tools/rs-server/RsSimpleRTPSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ std::string getSdpLineForVideoStream(rs2::video_stream_profile& t_videoStream, s
str.append(getSdpLineForField("fps", t_videoStream.fps()));
str.append(getSdpLineForField("stream_index", t_videoStream.stream_index()));
str.append(getSdpLineForField("stream_type", t_videoStream.stream_type()));
str.append(getSdpLineForField("bpp", RsSensor::getStreamProfileBpp(t_videoStream.format())));
str.append(getSdpLineForField("bpp", getStreamProfileBpp(t_videoStream.format())));
str.append(getSdpLineForField("cam_serial_num", device.get()->getDevice().get_info(RS2_CAMERA_INFO_SERIAL_NUMBER)));
str.append(getSdpLineForField("usb_type", device.get()->getDevice().get_info(RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR)));
str.append(getSdpLineForField("compression", CompressionFactory::getIsEnabled()));
Expand Down