static void S3_HLS_Add_Buffer_To_Queue()

in S3_HLS_SDK.c [106:141]


static void  S3_HLS_Add_Buffer_To_Queue(S3_HLS_BUFFER_PART_CTX* ctx) {
    SDK_DEBUG("Adding buffer to queue!\n");
    if(NULL == ctx) {
        SDK_DEBUG("Invalid CTX!\n");
        return;
    }
    
    if(NULL == ctx->first_part_start && 0 != ctx->first_part_length) {
        SDK_DEBUG("Invalid First Part!\n");
        return;
    }

    if(NULL == ctx->second_part_start && 0 != ctx->second_part_length) {
        SDK_DEBUG("Invalid Second Part!\n");
        return;
    }
        
    if(0 == ctx->first_part_length + ctx->second_part_length) {
        SDK_DEBUG("Empty Part!\n");
        return;
    }
    
    int32_t ret = S3_HLS_Add_To_Queue(s3_hls_queue_ctx, ctx->first_part_start, ctx->first_part_length, ctx->second_part_start, ctx->second_part_length, ctx->timestamp);
    if(0 != ret) {
        // unknown error
        SDK_DEBUG("Add item to queue failed! %d\n", ret);
        return;
    }

    SDK_DEBUG("Added to queue!\n");

	ret = sem_post(&s3_hls_put_send_sem);
	if(0 != ret) {
	    SDK_DEBUG("Error, post semaphore failed! %d\n", ret);
	}
}