All Products
Search
Document Center

:lv_stream_send_media

Last Updated:Mar 01, 2022

Sends video and audio data.

Description

int lv_stream_send_media(int service_id, const lv_stream_send_media_param_s *param);

The following table describes the related parameters.

Parameter

Type

Description

service_id

int

The ID of the request.

param

const lv_stream_send_media_param_s *

The additional parameters, such as the audio and video data.

Sample code

Note

The sample code is provided for reference only. The complete code is contained in the SDK.

// The callback function is defined in SDK Demo to obtain audio and video frame data.
void linkvisual_client_video_handler(int service_id, lv_video_format_e format, unsigned char *buffer, unsigned int buffer_size,
                                     unsigned int present_time, int nal_type) {
    //printf("video service_id:%d, format:%d, present_time:%u nal_type:%d size %u\n", service_id, format, present_time, nal_type, buffer_size);
    lv_stream_send_media_param_s param = {{0}};
    param.common.type = LV_STREAM_MEDIA_VIDEO;
    param.common.p = (char *)buffer;
    param.common.len = buffer_size;
    param.common.timestamp_ms = present_time;
    param.video.format = format;
    param.video.key_frame = nal_type;
    lv_stream_send_media(service_id, &param);
}