Skip to content

Commit

Permalink
Frame queues for each stream, not per extension
Browse files Browse the repository at this point in the history
  • Loading branch information
OhadMeir committed Jan 15, 2024
1 parent d2bf285 commit f49d17f
Show file tree
Hide file tree
Showing 27 changed files with 168 additions and 73 deletions.
18 changes: 10 additions & 8 deletions src/archive.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2019 Intel Corporation. All Rights Reserved.
#include "archive.h"
#include "metadata-parser.h"
#include "frame-archive.h"
#include "core/pose-frame.h"
#include "core/motion-frame.h"
#include "core/disparity-frame.h"
#include "composite-frame.h"
#include "points.h"


#include <src/archive.h>
#include <src/frame-archive.h>
#include <src/core/video-frame.h>
#include <src/core/pose-frame.h>
#include <src/core/motion-frame.h>
#include <src/core/disparity-frame.h>
#include <src/composite-frame.h>
#include <src/points.h>


namespace librealsense
Expand Down
1 change: 0 additions & 1 deletion src/archive.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#pragma once

#include "core/stream-profile.h"
#include "core/frame-additional-data.h"
#include "callback-invocation.h"

Expand Down
3 changes: 2 additions & 1 deletion src/core/pose-frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
#pragma once

#include <src/frame.h>
#include "extension.h"
#include <src/types.h>

#include "extension.h"

namespace librealsense {

Expand Down
1 change: 1 addition & 0 deletions src/dds/rs-dds-device-proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <rsutils/json.h>
#include <rsutils/string/hexarray.h>
#include <rsutils/string/from.h>


namespace librealsense {
Expand Down
1 change: 1 addition & 0 deletions src/dds/rs-dds-sensor-proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@


#include "sid_index.h"
#include <src/frame.h>
#include <src/software-sensor.h>
#include <src/proc/formats-converter.h>

Expand Down
1 change: 1 addition & 0 deletions src/ds/d400/d400-color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <src/backend.h>
#include <src/platform/platform-utils.h>
#include <src/fourcc.h>
#include <src/metadata-parser.h>

#include <src/ds/features/auto-exposure-roi-feature.h>

Expand Down
1 change: 1 addition & 0 deletions src/ds/d400/d400-motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "proc/motion-transform.h"
#include "proc/auto-exposure-processor.h"
#include <src/fourcc.h>
#include <src/metadata-parser.h>

using namespace librealsense;
namespace librealsense
Expand Down
1 change: 1 addition & 0 deletions src/ds/d500/d500-color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "backend.h"
#include "platform/platform-utils.h"
#include <src/fourcc.h>
#include <src/metadata-parser.h>

#include <src/ds/features/auto-exposure-roi-feature.h>

Expand Down
1 change: 1 addition & 0 deletions src/ds/d500/d500-motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "proc/motion-transform.h"
#include "proc/auto-exposure-processor.h"
#include "backend.h"
#include <src/metadata-parser.h>

using namespace librealsense;
namespace librealsense
Expand Down
1 change: 1 addition & 0 deletions src/ds/ds-color-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <src/platform/uvc-option.h>
#include <src/ds/features/auto-exposure-roi-feature.h>
#include <src/metadata-parser.h>

#include <cstddef>

Expand Down
1 change: 1 addition & 0 deletions src/ds/ds-motion-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "ds-private.h"
#include <src/stream.h>
#include <src/fourcc.h>
#include <src/metadata-parser.h>

#include <cstddef>

Expand Down
2 changes: 2 additions & 0 deletions src/ds/ds-timestamp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include "ds-private.h"
#include "ds-timestamp.h"
#include <src/frame.h>
#include <src/core/time-service.h>

#include <mutex>
#include <chrono>
Expand Down
4 changes: 4 additions & 0 deletions src/frame-archive.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
#pragma once

#include "archive.h"
#include <src/core/frame-interface.h>

#include <atomic>
#include <vector>

namespace librealsense
{
Expand Down
8 changes: 6 additions & 2 deletions src/hid-sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "metadata.h"
#include "platform/stream-profile-impl.h"
#include "fourcc.h"
#include <src/metadata-parser.h>
#include <src/core/time-service.h>


namespace librealsense {
Expand Down Expand Up @@ -234,8 +236,10 @@ void hid_sensor::start( rs2_frame_callback_sptr callback )

last_frame_number = frame_counter;
last_timestamp = timestamp;
frame_holder frame
= _source.alloc_frame( RS2_EXTENSION_MOTION_FRAME, data_size, std::move( fr->additional_data ), true );
frame_holder frame = _source.alloc_frame( { request->get_stream_type(), RS2_EXTENSION_MOTION_FRAME },
data_size,
std::move( fr->additional_data ),
true );
memcpy( (void *)frame->get_frame_data(),
sensor_data.fo.pixels,
sizeof( uint8_t ) * sensor_data.fo.frame_size );
Expand Down
11 changes: 8 additions & 3 deletions src/media/ros/ros_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,11 @@ namespace librealsense
}

frame_interface * frame = m_frame_source->alloc_frame(
frame_source::stream_to_frame_types(stream_id.stream_type),
{ stream_id.stream_type, frame_source::stream_to_frame_types( stream_id.stream_type ) },
msg->data.size(),
std::move( additional_data ),
true );

if (frame == nullptr)
{
LOG_WARNING("Failed to allocate new frame");
Expand Down Expand Up @@ -487,7 +488,7 @@ namespace librealsense
get_frame_metadata(m_file, info_topic, stream_id, motion_data, additional_data);
}

frame_interface * frame = m_frame_source->alloc_frame( RS2_EXTENSION_MOTION_FRAME,
frame_interface * frame = m_frame_source->alloc_frame( { stream_id.stream_type, RS2_EXTENSION_MOTION_FRAME },
3 * sizeof( float ),
std::move( additional_data ),
true );
Expand Down Expand Up @@ -636,7 +637,11 @@ namespace librealsense

additional_data.timestamp = timestamp_ms.count();

frame_interface* new_frame = m_frame_source->alloc_frame(frame_type, frame_size, std::move( additional_data ), true);
frame_interface * new_frame = m_frame_source->alloc_frame( { stream_id.stream_type, frame_type },
frame_size,
std::move( additional_data ),
true );

if (new_frame == nullptr)
{
LOG_WARNING("Failed to allocate new frame");
Expand Down
1 change: 1 addition & 0 deletions src/pipeline/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "platform/platform-device-info.h"
#include "media/playback/playback-device-info.h"
#include "context.h"
#include <rsutils/string/from.h>


namespace librealsense
Expand Down
1 change: 1 addition & 0 deletions src/platform-camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "backend.h"
#include "platform/platform-utils.h"
#include <src/fourcc.h>
#include <src/metadata-parser.h>


namespace librealsense {
Expand Down
1 change: 1 addition & 0 deletions src/proc/auto-exposure-processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright(c) 2019 Intel Corporation. All Rights Reserved.

#include "auto-exposure-processor.h"
#include <src/frame.h>

librealsense::auto_exposure_processor::auto_exposure_processor(rs2_stream stream, enable_auto_exposure_option& enable_ae_option)
: auto_exposure_processor("Auto Exposure Processor", stream, enable_ae_option) {}
Expand Down
2 changes: 2 additions & 0 deletions src/proc/hole-filling-filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// Enhancing the input video frame by filling missing data.
#pragma once

#include <rsutils/string/from.h>

namespace librealsense
{
enum holes_filling_types : uint8_t
Expand Down
20 changes: 14 additions & 6 deletions src/proc/synthetic-stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "option.h"
#include "stream.h"
#include "types.h"
#include <src/core/time-service.h>

#include <rsutils/string/from.h>

Expand Down Expand Up @@ -39,7 +40,8 @@ namespace librealsense

void processing_block::invoke(frame_holder f)
{
auto callback = _source.begin_callback();
frame_source::archive_id id = { f->get_stream()->get_stream_type(), RS2_EXTENSION_VIDEO_FRAME };
auto callback = _source.begin_callback( id );
try
{
if (_callback)
Expand Down Expand Up @@ -348,11 +350,11 @@ namespace librealsense
data.timestamp = original->get_frame_timestamp();
data.timestamp_domain = original->get_frame_timestamp_domain();
data.metadata_size = 0;
data.system_time = _actual_source.get_time();
data.system_time = time_service::get_time();
data.is_blocking = original->is_blocking();

auto res
= _actual_source.alloc_frame( frame_type,
= _actual_source.alloc_frame( { vid_stream->get_stream_type(), frame_type },
vid_stream->get_width() * vid_stream->get_height() * sizeof( float ) * 5,
std::move( data ),
true );
Expand Down Expand Up @@ -419,7 +421,10 @@ namespace librealsense
throw std::runtime_error("Can not cast frame interface to frame");

frame_additional_data data = of->additional_data;
auto res = _actual_source.alloc_frame( frame_type, stride * height, std::move( data ), true );
auto res = _actual_source.alloc_frame( { stream->get_stream_type(), frame_type },
stride * height,
std::move( data ),
true );
if (!res) throw wrong_api_call_sequence_exception("Out of frame resources!");
vf = dynamic_cast<video_frame*>(res);
if (!vf)
Expand Down Expand Up @@ -451,7 +456,10 @@ namespace librealsense
throw std::runtime_error("Frame interface is not frame");

frame_additional_data data = of->additional_data;
auto res = _actual_source.alloc_frame( frame_type, of->get_frame_data_size(), std::move( data ), true );
auto res = _actual_source.alloc_frame( { stream->get_stream_type(), frame_type },
of->get_frame_data_size(),
std::move( data ),
true );
if (!res) throw wrong_api_call_sequence_exception("Out of frame resources!");

auto mf = dynamic_cast<motion_frame*>(res);
Expand Down Expand Up @@ -501,7 +509,7 @@ namespace librealsense
for (auto&& f : holders)
req_size += get_embeded_frames_size(f.frame);

auto res = _actual_source.alloc_frame( RS2_EXTENSION_COMPOSITE_FRAME,
auto res = _actual_source.alloc_frame( { RS2_STREAM_ANY, RS2_EXTENSION_COMPOSITE_FRAME }, // Special case for composite frames
req_size * sizeof( rs2_frame * ),
std::move( d ),
true );
Expand Down
1 change: 1 addition & 0 deletions src/rs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#include "composite-frame.h"
#include "points.h"

#include <src/core/time-service.h>
#include <rsutils/string/from.h>

////////////////////////
Expand Down
2 changes: 2 additions & 0 deletions src/sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "core/stream-profile-interface.h"
#include "core/frame-callback.h"
#include "core/notification.h"
#include <src/metadata-parser.h>


#include <rsutils/string/from.h>
#include <rsutils/json.h>
Expand Down
3 changes: 3 additions & 0 deletions src/sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "core/extension.h"
#include "proc/formats-converter.h"
#include <src/synthetic-options-watcher.h>
#include <src/platform/stream-profile.h>
#include <src/platform/frame-object.h>

#include <rsutils/lazy.h>
#include <rsutils/signal.h>
Expand Down Expand Up @@ -45,6 +47,7 @@ namespace librealsense
};

class notifications_processor;
class frame;

class sensor_base
: public std::enable_shared_from_this< sensor_base >
Expand Down
5 changes: 3 additions & 2 deletions src/software-sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "core/video-frame.h"
#include "core/notification.h"
#include "depth-sensor.h"
#include <src/metadata-parser.h>

#include <rsutils/string/from.h>
#include <rsutils/deferred.h>
Expand Down Expand Up @@ -218,10 +219,10 @@ frame_interface * software_sensor::allocate_new_frame( rs2_extension extension,
frame_additional_data && data )
{
auto frame_number = data.frame_number; // For logging
auto frame = _source.alloc_frame( extension, 0, std::move( data ), false );
auto frame = _source.alloc_frame( { profile->get_stream_type(), extension }, 0, std::move( data ), false );
if( ! frame )
{
LOG_WARNING( "Failed to allocate frame " << frame_number << " type " << extension );
LOG_WARNING( "Failed to allocate frame " << frame_number << " type " << profile->get_stream_type() );
}
else
{
Expand Down
Loading

0 comments on commit f49d17f

Please sign in to comment.