diff --git a/src/ethernet/ip_device.cpp b/src/ethernet/ip_device.cpp index f0e8f51d9f..66f36f5343 100644 --- a/src/ethernet/ip_device.cpp +++ b/src/ethernet/ip_device.cpp @@ -362,10 +362,9 @@ void ip_device::inject_frames_loop(std::shared_ptr 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. - 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); diff --git a/src/ipDeviceCommon/RsCommon.cpp b/src/ipDeviceCommon/RsCommon.cpp new file mode 100644 index 0000000000..ef770b9012 --- /dev/null +++ b/src/ipDeviceCommon/RsCommon.cpp @@ -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; + } +} diff --git a/src/ipDeviceCommon/RsCommon.h b/src/ipDeviceCommon/RsCommon.h index aa5ac62bc9..50bece246a 100644 --- a/src/ipDeviceCommon/RsCommon.h +++ b/src/ipDeviceCommon/RsCommon.h @@ -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) diff --git a/third-party/live555/CMakeLists.txt b/third-party/live555/CMakeLists.txt index afdf2cd9ce..04ad0c9439 100644 --- a/third-party/live555/CMakeLists.txt +++ b/third-party/live555/CMakeLists.txt @@ -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) diff --git a/third-party/live555/live555-latest.tar.gz b/third-party/live555/live555-latest.tar.gz new file mode 100644 index 0000000000..2f202fd422 Binary files /dev/null and b/third-party/live555/live555-latest.tar.gz differ diff --git a/tools/rs-server/RsRTSPServer.cpp b/tools/rs-server/RsRTSPServer.cpp index 8d058400a7..f7175b2c06 100644 --- a/tools/rs-server/RsRTSPServer.cpp +++ b/tools/rs-server/RsRTSPServer.cpp @@ -18,15 +18,15 @@ RsRTSPServer* RsRTSPServer::createNew(UsageEnvironment& t_env, std::shared_ptr 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 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 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) {} diff --git a/tools/rs-server/RsRTSPServer.hh b/tools/rs-server/RsRTSPServer.hh index daf9a86dca..86b7e236d6 100644 --- a/tools/rs-server/RsRTSPServer.hh +++ b/tools/rs-server/RsRTSPServer.hh @@ -15,7 +15,7 @@ public: void setSupportedOptions(std::string t_key, std::vector t_supportedOptions); protected: - RsRTSPServer(UsageEnvironment& t_env, std::shared_ptr t_device, int t_ourSocketIPv4, int t_ourSocketIPv6, Port t_ourPort, UserAuthenticationDatabase* t_authDatabase, unsigned t_reclamationSeconds); + RsRTSPServer(UsageEnvironment& t_env, std::shared_ptr t_device, int t_ourSocket, Port t_ourPort, UserAuthenticationDatabase* t_authDatabase, unsigned t_reclamationSeconds); virtual ~RsRTSPServer(); char const* allowedCommandNames(); diff --git a/tools/rs-server/RsSensor.cpp b/tools/rs-server/RsSensor.cpp index b23131048c..1286415a28 100644 --- a/tools/rs-server/RsSensor.cpp +++ b/tools/rs-server/RsSensor.cpp @@ -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" @@ -38,7 +39,7 @@ int RsSensor::open(std::unordered_map& 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 compressPtr = CompressionFactory::getObject(vsp.width(), vsp.height(), vsp.format(), vsp.stream_type(), RsSensor::getStreamProfileBpp(vsp.format())); + std::shared_ptr compressPtr = CompressionFactory::getObject(vsp.width(), vsp.height(), vsp.format(), vsp.stream_type(), getStreamProfileBpp(vsp.format())); if(compressPtr != nullptr) { m_iCompress.insert(std::pair>(streamProfileKey, compressPtr)); @@ -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 RsSensor::getSupportedOptions() { std::vector returnedVector; @@ -182,11 +141,6 @@ std::vector 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); } } diff --git a/tools/rs-server/RsSensor.hh b/tools/rs-server/RsSensor.hh index 064453e106..f34eeb32b2 100644 --- a/tools/rs-server/RsSensor.hh +++ b/tools/rs-server/RsSensor.hh @@ -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; diff --git a/tools/rs-server/RsSimpleRTPSink.cpp b/tools/rs-server/RsSimpleRTPSink.cpp index cb2d55acd5..5556506a42 100644 --- a/tools/rs-server/RsSimpleRTPSink.cpp +++ b/tools/rs-server/RsSimpleRTPSink.cpp @@ -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()));