Merge pull request #2108 from signalwire/add_new_media_getters

[core] Add switch_core_media_get_engine() and switch_core_media_get_codec() functions
This commit is contained in:
Andrey Volk 2023-06-09 22:48:30 +03:00 committed by GitHub
commit 13ae4e3853
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 2 deletions

View File

@ -399,6 +399,10 @@ SWITCH_DECLARE(void) switch_core_media_set_smode(switch_core_session_t *session,
SWITCH_DECLARE(void) switch_core_media_set_resolveice(switch_bool_t resolve_ice);
SWITCH_DECLARE(switch_bool_t) switch_core_media_has_resolveice(void);
typedef struct switch_rtp_engine_s switch_rtp_engine_t;
SWITCH_DECLARE(switch_rtp_engine_t *) switch_core_media_get_engine(switch_core_session_t *session, int media_type);
SWITCH_DECLARE(switch_codec_t*) switch_core_media_get_codec(switch_core_session_t *session, switch_media_type_t type);
SWITCH_END_EXTERN_C
#endif
/* For Emacs:

View File

@ -110,7 +110,7 @@ struct switch_rtp_text_factory_s {
};
typedef struct switch_rtp_engine_s {
struct switch_rtp_engine_s {
switch_secure_settings_t ssec[CRYPTO_INVALID+1];
switch_rtp_crypto_key_type_t crypto_type;
@ -204,7 +204,7 @@ typedef struct switch_rtp_engine_s {
void *engine_user_data;
int8_t engine_function_running;
switch_frame_buffer_t *write_fb;
} switch_rtp_engine_t;
};
#define MAX_REJ_STREAMS 10
@ -16421,7 +16421,21 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
return status;
}
SWITCH_DECLARE(switch_rtp_engine_t *) switch_core_media_get_engine(switch_core_session_t *session, int media_type)
{
if (!session) return NULL;
return &session->media_handle->engines[media_type];
}
SWITCH_DECLARE(switch_codec_t*) switch_core_media_get_codec(switch_core_session_t *session, switch_media_type_t type)
{
switch_rtp_engine_t *engine = switch_core_media_get_engine(session, type);
if (!engine) return NULL;
return &engine->read_codec;
}
/* For Emacs:
* Local Variables: