Skip to content
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
3 changes: 1 addition & 2 deletions docs/SDK_API_Definition.md
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,9 @@ NOTE: The codes are negative integer values.
| `-MESH_ERR_BAD_CONFIG_PTR` | Bad configuration pointer | The configuration pointer is NULL. |
| `-MESH_ERR_BAD_BUF_PTR` | Bad buffer pointer | The buffer pointer is NULL. |
| `-MESH_ERR_BAD_BUF_LEN` | Bad buffer length | **Rx connection**: The buffer length is corrupted.<br>**Tx connection**: The buffer length is bigger than maximum. |
| `-MESH_ERR_CLIENT_FAILED` | Client creation failed | An error occurred while creating an SDK client. |
| `-MESH_ERR_CLIENT_CONFIG_INVAL` | Invalid client config | JSON client configuration string is malformed. |
| `-MESH_ERR_MAX_CONN` | Reached max connections number | An attempt to create a connection failed due to reaching the maximum number of connections defined in `"maxMediaConnections"`. |
| `-MESH_ERR_FOUND_ALLOCATED` | Found allocated resources | When deleting an SDK client, some connections were found not closed. Delete all connections explicitly before deleting the client. |
| `-MESH_ERR_FOUND_ALLOCATED` | Found allocated resources | When deleting a client, some connections were found not closed. Delete all connections explicitly before deleting the client. |
| `-MESH_ERR_CONN_FAILED` | Connection creation failed | An error occurred while creating a connection. |
| `-MESH_ERR_CONN_CONFIG_INVAL` | Invalid connection config | JSON connection configuration string is malformed or one of parameters has an incorrect value. |
| `-MESH_ERR_CONN_CONFIG_INCOMPAT` | Incompatible connection config | Incompatible parameters found in the JSON connection configuration string. |
Expand Down
21 changes: 15 additions & 6 deletions ffmpeg-plugin/mcm_audio_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,19 @@ static int mcm_audio_read_packet(AVFormatContext* avctx, AVPacket* pkt)
s->first_frame = false;

err = mesh_get_buffer_timeout(s->conn, &buf, timeout);
if (err == -MESH_ERR_CONN_CLOSED)
return AVERROR_EOF;

if (err == -MESH_ERR_CONN_CLOSED) {
ret = AVERROR_EOF;
goto error_close_conn;
}
if (err) {
if (mcm_shutdown_requested()) {
return AVERROR_EXIT;
ret = AVERROR_EXIT;
} else {
av_log(avctx, AV_LOG_ERROR, "Get buffer error: %s (%d)\n",
mesh_err2str(err), err);
return AVERROR(EIO);
ret = AVERROR(EIO);
}
goto error_close_conn;
}

if (mcm_shutdown_requested()) {
Expand All @@ -164,14 +166,21 @@ static int mcm_audio_read_packet(AVFormatContext* avctx, AVPacket* pkt)
if (err) {
av_log(avctx, AV_LOG_ERROR, "Put buffer error: %s (%d)\n",
mesh_err2str(err), err);
return AVERROR(EIO);
ret = AVERROR(EIO);
goto error_close_conn;
}

return len;

error_put_buf:
mesh_put_buffer(&buf);

error_close_conn:
err = mesh_delete_connection(&s->conn);
if (err)
av_log(avctx, AV_LOG_ERROR, "Delete mesh connection failed: %s (%d)\n",
mesh_err2str(err), err);

return ret;
}

Expand Down
18 changes: 12 additions & 6 deletions ffmpeg-plugin/mcm_video_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,19 @@ static int mcm_video_read_packet(AVFormatContext* avctx, AVPacket* pkt)
s->first_frame = false;

err = mesh_get_buffer_timeout(s->conn, &buf, timeout);
if (err == -MESH_ERR_CONN_CLOSED)
return AVERROR_EOF;

if (err == -MESH_ERR_CONN_CLOSED) {
ret = AVERROR_EOF;
goto error_close_conn;
}
if (err) {
if (mcm_shutdown_requested()) {
return AVERROR_EXIT;
ret = AVERROR_EXIT;
} else {
av_log(avctx, AV_LOG_ERROR, "Get buffer error: %s (%d)\n",
mesh_err2str(err), err);
return AVERROR(EIO);
ret = AVERROR(EIO);
}
goto error_close_conn;
}

if (mcm_shutdown_requested()) {
Expand All @@ -159,14 +161,18 @@ static int mcm_video_read_packet(AVFormatContext* avctx, AVPacket* pkt)
if (err) {
av_log(avctx, AV_LOG_ERROR, "Put buffer error: %s (%d)\n",
mesh_err2str(err), err);
return AVERROR(EIO);
ret = AVERROR(EIO);
goto error_close_conn;
}

return len;

error_put_buf:
mesh_put_buffer(&buf);

error_close_conn:
mesh_delete_connection(&s->conn);

return ret;
}

Expand Down
1 change: 0 additions & 1 deletion media-proxy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ endif()

# Define the .proto files
set(PROTO_FILES
${PROTO_DIR}/type.proto
${PROTO_DIR}/conn-config.proto
${PROTO_DIR}/sdk.proto
${PROTO_DIR}/mediaproxy.proto
Expand Down
29 changes: 0 additions & 29 deletions media-proxy/include/mesh/client.h

This file was deleted.

56 changes: 0 additions & 56 deletions media-proxy/include/mesh/client_registry.h

This file was deleted.

5 changes: 0 additions & 5 deletions media-proxy/include/mesh/conn.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,6 @@ class Connection : public telemetry::MetricsProvider {
Connection * link();

void set_config(const Config& cfg);
void set_parent(const std::string& parent_id);

void notify_parent_conn_unlink_requested(context::Context& ctx);

Result establish(context::Context& ctx);
Result establish_async(context::Context& ctx);
Expand All @@ -230,7 +227,6 @@ class Connection : public telemetry::MetricsProvider {
} info;

Config config;
std::string legacy_sdk_id;

protected:
void set_state(context::Context& ctx, State new_state);
Expand Down Expand Up @@ -272,7 +268,6 @@ class Connection : public telemetry::MetricsProvider {
context::Context establish_ctx = context::WithCancel(context::Background());
std::jthread establish_th;
std::jthread shutdown_th;
std::string parent_id;
};

const char * kind2str(Kind kind, bool brief = false);
Expand Down
7 changes: 2 additions & 5 deletions media-proxy/include/mesh/conn_registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ class Registry {
return ids;
}

int size() {
std::shared_lock lk(mx);
return conns.size();
}

private:
std::unordered_map<std::string, Connection *> conns;

Expand All @@ -73,6 +68,8 @@ class Registry {
std::shared_mutex mx;
};

extern Registry registry;

} // namespace mesh::connection

#endif // CONN_REGISTRY_H
108 changes: 0 additions & 108 deletions media-proxy/include/mesh/event.h

This file was deleted.

7 changes: 2 additions & 5 deletions media-proxy/include/mesh/manager_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ namespace mesh::connection {
class LocalManager {
public:
int create_connection_sdk(context::Context& ctx, std::string& id,
const std::string& client_id, mcm_conn_param *param,
memif_conn_param *memif_param,
mcm_conn_param *param, memif_conn_param *memif_param,
const Config& conn_config, std::string& err_str);

Result activate_connection_sdk(context::Context& ctx, const std::string& id);
int activate_connection_sdk(context::Context& ctx, const std::string& id);

int delete_connection_sdk(context::Context& ctx, const std::string& id,
bool do_unregister = true);
Expand All @@ -30,8 +29,6 @@ class LocalManager {

int reregister_all_connections(context::Context& ctx);

int notify_all_shutdown_wait(context::Context& ctx);

void shutdown(context::Context& ctx);

void lock();
Expand Down
2 changes: 1 addition & 1 deletion media-proxy/include/mesh/st2110.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ template <typename FRAME, typename HANDLE, typename OPS> class ST2110 : public C

mtl_session = create_session(mtl_device, &ops);
if (!mtl_session) {
log::error("Failed to create MTL session");
log::error("Failed to create session");
set_state(ctx, State::closed);
return set_result(Result::error_general_failure);
}
Expand Down
Loading
Loading