{
espp_service_data_from_client_s data;
espp_service_data_from_server_s result;
+ g_autofree gchar *base64_codec_data = NULL;
ASSERT(espp);
ASSERT(info);
RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+ /* NOTE that encoding 'codec_data' member with base64 to avoid parsing json string error on the daemon side. */
+ if (info->codec_data_length > 0)
+ base64_codec_data = g_base64_encode((guchar *)info->codec_data, info->codec_data_length);
FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_AUDIO_STREAM_INFO);
FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_AUDIO_STREAM_INFO,
- "codec_data", info->codec_data, "codec_data_length", info->codec_data_length, "mime_type", info->mime_type,
+ "codec_data", base64_codec_data, "codec_data_length", info->codec_data_length, "mime_type", info->mime_type,
"bitrate", info->bitrate, "channels", info->channels, "sample_rate", info->sample_rate);
if (send_data(espp->fd, &data, &result) != 0)
return -1;
{
espp_service_data_from_client_s data;
espp_service_data_from_server_s result;
+ g_autofree gchar *base64_codec_data = NULL;
ASSERT(espp);
ASSERT(info);
RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+ /* NOTE that encoding 'codec_data' member with base64 to avoid parsing json string error on the daemon side. */
+ if (info->codec_data_length > 0)
+ base64_codec_data = g_base64_encode((guchar *)info->codec_data, info->codec_data_length);
FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_VIDEO_STREAM_INFO);
FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_VIDEO_STREAM_INFO,
- "codec_data", info->codec_data, "codec_data_length", info->codec_data_length, "mime_type", info->mime_type,
+ "codec_data", base64_codec_data, "codec_data_length", info->codec_data_length, "mime_type", info->mime_type,
"width", info->width, "height", info->height, "max_width", info->max_width, "max_height", info->max_height,
"framerate_num", info->framerate_num, "framerate_den", info->framerate_den);
if (send_data(espp->fd, &data, &result) != 0)
{
int ret;
esplusplayer_audio_stream_info info;
+ g_autofree guchar *codec_data = NULL;
+ gsize len;
ASSERT(hdata);
ASSERT(data);
if (ret != 0)
return;
+ /* NOTE that decoding 'codec_data' member with base64 here, see the client side. */
+ if (info.codec_data_length > 0) {
+ LOG_DEBUG("base64 codec_data[%s]", info.codec_data);
+ codec_data = g_base64_decode((gchar *)info.codec_data, &len);
+ ASSERT(len == info.codec_data_length);
+ info.codec_data = (char *)codec_data;
+ }
ret = esplusplayer_set_audio_stream_info((esplusplayer_handle)hdata->espp, &info);
RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_audio_stream_info(), ESPP[%p]", hdata->espp);
{
int ret;
esplusplayer_video_stream_info info;
+ g_autofree guchar *codec_data = NULL;
+ gsize len;
ASSERT(hdata);
ASSERT(data);
if (ret != 0)
return;
+ /* NOTE that decoding 'codec_data' member with base64 here, see the client side. */
+ if (info.codec_data_length > 0) {
+ LOG_DEBUG("base64 codec_data[%s]", info.codec_data);
+ codec_data = g_base64_decode((gchar *)info.codec_data, &len);
+ ASSERT(len == info.codec_data_length);
+ info.codec_data = (char *)codec_data;
+ }
ret = esplusplayer_set_video_stream_info((esplusplayer_handle)hdata->espp, &info);
RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_video_stream_info(), ESPP[%p]", hdata->espp);
if (ret != 0)
return;
- RET_IF(cb_type < ESPP_SERVICE_EVENT_CB_READY_TO_PREPARE || cb_type > ESPP_SERVICE_EVENT_CB_RESOURCE_CONFLICTED,
+ RET_IF(cb_type < ESPP_SERVICE_EVENT_CB_READY_TO_PREPARE || cb_type > ESPP_SERVICE_EVENT_CB_ERROR,
"invalid cb_type[%d]", cb_type);
ret = cb_setters[cb_type].set_cb((esplusplayer_handle)hdata->espp, cb_setters[cb_type].callback, hdata);