Пример #1
0
static __inline__ int32_t
__ldh_src_open(ldh_src *ldh, media_uri *mrl)
{
    int32_t err = -EPERM, ch, level, type;
    uint8_t prop[PROPERTY_BUF_LEN], start_time[TIME_BUF_LEN],end_time[TIME_BUF_LEN];

    if (!hso || !hso->open)
        return err;

    err = __parse_mrl(mrl, &ch, &level, &type, start_time,
        end_time, prop, NULL);
    if (err)
    {
        LOG_W(
            "__ldh_src_open()->__parse_mrl(%s) failed, err:'%d'.",
            __str(mrl), err
        );
        return err;
    }

    err = (*hso->open)((avs_media*)ldh, ch, level, type,
        start_time, end_time, prop);
    if (err)
    {
        LOG_W(
            "__ldh_src_open()->(*hso->open)(%s) failed, err:'%d'.",
            __str(mrl), err
        );
        return err;
    }

    ldh->state = OPENED;
    return 0;
}
Пример #2
0
bool files_init(honggfuzz_t * hfuzz)
{
    hfuzz->files = util_Malloc(sizeof(char *));
    hfuzz->files[0] = "NONE";
    hfuzz->fileCnt = 1;

    if (hfuzz->externalCommand) {
        LOG_I
            ("No input file corpus loaded, the external command '%s' is responsible for creating the fuzz files",
             hfuzz->externalCommand);
        return true;
    }

    if (!hfuzz->inputDir) {
        LOG_W("No input file/dir specified");
        return false;
    }

    struct stat st;
    if (stat(hfuzz->inputDir, &st) == -1) {
        PLOG_W("Couldn't stat the input dir '%s'", hfuzz->inputDir);
        return false;
    }

    if (S_ISDIR(st.st_mode)) {
        return files_readdir(hfuzz);
    }

    LOG_W("The initial corpus directory '%s' is not a directory", hfuzz->inputDir);
    return false;
}
Пример #3
0
static media_src *
create_local_media_src(tr_factory *tr_f, int32_t m_type)
{
	ld_src *src;

	if (m_type == 0)
	{
		src = (ld_src*)ldl_src_alloc(NULL);
		if (!src)
		{
			LOG_W("Create local hitory media src failed.");
		}
	}
	else
	{
		src = (ld_src*)ldh_src_alloc(NULL);
		if (!src)
		{
			LOG_W("Create local hitory media src failed.");
		}
		else
		{
			if (m_type == MS_DOWNLD)
			{
				ldh_src_set_download_mode((ldh_src*)src);
			}
		}
	}
	return (media_src*)src;
}
Пример #4
0
static __inline__ void
rtsp_method_do_desc(rtsp_client *rc, rtsp_message *req, media *media)
{
	RTSP_STATUS_CODE rsc;
	rtsp_message *res;
	int32_t err, sdp_size;
	media_info mi;
	sdp_message *sdp = NULL;
	char *content_base = NULL;
	uint8_t *sdp_buf;
	uint32_t cb_size;

	err = media_info_get(media, &mi);
	if (!err)
	{
		content_base = rtsp_method_get_content_base(req, &cb_size);
		if (!content_base)
		{
			LOG_W(
				"rtsp_method_do_desc()->rtsp_method_get_content_base() failed."
			);
			err = -EINVAL;
			goto desc_err;
		}

		sdp = rtsp_method_mi_to_sdp(&mi);
		sdp_buf = (uint8_t*)rtsp_mem_alloc(MAX_RTSP_BUF_SIZE);
		sdp_size = sdp_message_as_text(sdp, (char*)sdp_buf, MAX_RTSP_BUF_SIZE);
		sdp_message_free(sdp);
		if (sdp_size < 0 || sdp_size >= MAX_RTSP_BUF_SIZE)
		{
			LOG_W(
				"rtsp_method_do_desc()->sdp_message_as_text() failed."
			);
			tr_free(content_base, cb_size);
			err = -EINVAL;
			goto desc_err;
		}

		media_info_clear(&mi);
		res = rtsp_impl_new_generic_response(req, RTSP_STS_OK);
		rtsp_message_take_body(res, sdp_buf, sdp_size);
		rtsp_message_add_header(res, RTSP_HDR_CONTENT_TYPE, "application/sdp");
		rtsp_message_add_header(res, RTSP_HDR_CONTENT_BASE, content_base);
		tr_free(content_base, cb_size);
		rtsp_impl_send_message(rc, res);
		return;
	}

desc_err:
	media_info_clear(&mi);
	rsc = rtsp_impl_trans_status_code(TR_RTSP_DESC, err);
	res = rtsp_impl_new_generic_response(req, rsc);
	rtsp_impl_send_message(rc, res);
}
Пример #5
0
static __inline__ void
__ldh_src_read_ahead(ldh_src *ldh)
{
    int32_t err, vfrm_count = 0;
    frame_t *frm;

    if (!hso || !hso->pull)
    {
        LOG_W(
            "__ldh_src_read_ahead()->hso->pull is NULL."
        );
        return;
    }

    for (;;)
    {
        if (ldh->state != PLAYED || (ldh->flags & LDH_FLGS_EOF))   
            break;

        if (ldh->frm_count >= MAX_CACHED)
            break;

        if (vfrm_count >= PREREAD_BATCH)
            break;

        frm = NULL;
        err = (*hso->pull)((avs_media*)ldh, &frm);
        if (err)
        {
            LOG_W(
                "__ldh_src_read_ahead()->(*hso->pull) failed, err:'%d'",
                err
            );
            return;
        }

        if (frm)
        {
            ldh_fill_frm(ldh, frm);
            if (IS_VIDEO_FRAME(frm))
            {
                ++vfrm_count;
            }
        }
        else
        {
            LOG_W(
                "__ldh_src_read_ahead()->(*hso->pull) got 'NULL' frame"
            );
        }
    }

    ldh->flags &= ~LDH_FLGS_READING;
}
Пример #6
0
/*
This function is still a proof of concept, it's probably rife with bugs, below
is a short (and incomplete) todo
 * "Basic" checks (Read/Write/File/Dir) checks for FAT32 filesystems which
   requires detecting the filesystem being used.
*/
void Check(fs::path const& file, acs::Type type) {
	DWORD file_attr = GetFileAttributes(file.c_str());
	if ((file_attr & INVALID_FILE_ATTRIBUTES) == INVALID_FILE_ATTRIBUTES) {
		switch (GetLastError()) {
			case ERROR_FILE_NOT_FOUND:
			case ERROR_PATH_NOT_FOUND:
				throw fs::FileNotFound(file);
			case ERROR_ACCESS_DENIED:
				throw fs::ReadDenied(file);
			default:
				throw fs::FileSystemUnknownError(str(boost::format("Unexpected error when getting attributes for \"%s\": %s") % file % util::ErrorString(GetLastError())));
		}
	}

	switch (type) {
		case FileRead:
		case FileWrite:
			if ((file_attr & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY)
				throw fs::NotAFile(file);
			break;
		case DirRead:
		case DirWrite:
			if ((file_attr & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY)
				throw fs::NotADirectory(file);
			break;
	}

	SECURITY_INFORMATION info = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION;
	DWORD len = 0;
	GetFileSecurity(file.c_str(), info, nullptr, 0, &len);
	if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
		LOG_W("acs/check") << "GetFileSecurity: fatal: " << util::ErrorString(GetLastError());

	std::vector<uint8_t> sd_buff(len);
	SECURITY_DESCRIPTOR *sd = (SECURITY_DESCRIPTOR *)&sd_buff[0];

	if (!GetFileSecurity(file.c_str(), info, sd, len, &len))
		LOG_W("acs/check") << "GetFileSecurity failed: " << util::ErrorString(GetLastError());

	ImpersonateSelf(SecurityImpersonation);
	HANDLE client_token;
	if (!OpenThreadToken(GetCurrentThread(), TOKEN_ALL_ACCESS, TRUE, &client_token))
		LOG_W("acs/check") << "OpenThreadToken failed: " << util::ErrorString(GetLastError());

	if (!check_permission(true, sd, client_token))
		throw fs::ReadDenied(file);
	if ((type == DirWrite || type == FileWrite) && !check_permission(false, sd, client_token))
		throw fs::WriteDenied(file);
}
Пример #7
0
int get_all_files(PHandleFunc func, void* func_args)
{
	int ret = 0;
	if (!func) {
		LOG_E("func is null\n");
		ret = -1;
		goto out;
	}
	GPParams gp_params = {0};
	
	gp_params_init (&gp_params, NULL);
	if ( (ret = cam_detect_camera(&gp_params)) < 0)
		goto err_cam_detect;
	if (ret == 0)
		goto no_camera_detect;
	struct FuncArgu args = {func, func_args};
	get_file_recursive("/", &gp_params, &args);
	
release_param:
	gp_params_exit(&gp_params);
out:
	return ret;

no_camera_detect:
	LOG_W("no camera detected\n");
	goto release_param;
err_cam_detect:
	ret = -1;
	goto release_param;
}
        void ImOnlineAdapterServiceProxy::offline(long userId,bool isDelLongOnline){

            LOG_W(userId, "ImOnlineAdapterServiceProxy::offline", -1, "");

#ifndef INTERNATIONAL  
			ReadLock lock(mutex_);
			ImOnlineAdapterServicePrx proxy = getProxy(userId);//取ImOnlineAdapterService的代理

			if(!proxy){
				LOG_ERROR("ImOnlineAdapterServiceProxy::offline => get proxy failure : userId = " << userId << " isDelLongOnline=" << isDelLongOnline);
				return;
			}
			
			LOG_DEBUG("ImOnlineAdapterServiceProxy::offline <<userId = " << userId << " isDelLongOnline=" << isDelLongOnline<< " getProxy success.");
			      	
			try{
				proxy->offline(userId,isDelLongOnline);
				
			} catch (exception& e){
				LOG_ERROR("ImOnlineAdapterServiceProxy::offline => failure : proxy = " << proxy->ice_toString() << " exception = " << e.what()); 
				return;
			}catch(...){
				LOG_ERROR("ImOnlineAdapterServiceProxy::offline => failure : proxy = " << proxy->ice_toString() << " exception = unknow exception"  ); 
				return;
			}

			LOG_DEBUG("ImOnlineAdapterServiceProxy::offline => userId = " << userId << " isDelLongOnline=" << isDelLongOnline << " interface function call success");
#endif
			return;

 		}
Пример #9
0
//-----------------------------------------------------------------------------
int
gtpv1u_initial_req(
  gtpv1u_data_t *gtpv1u_data_pP,
  teid_t         teidP,
  tcp_udp_port_t portP,
  uint32_t       address)
{
  NwGtpv1uUlpApiT ulp_req;
  NwGtpv1uRcT     rc = NW_GTPV1U_FAILURE;

  memset(&ulp_req, 0, sizeof(NwGtpv1uUlpApiT));

  ulp_req.apiType = NW_GTPV1U_ULP_API_INITIAL_REQ;
  ulp_req.apiInfo.initialReqInfo.teid     = teidP;
  ulp_req.apiInfo.initialReqInfo.peerPort = portP;
  ulp_req.apiInfo.initialReqInfo.peerIp   = address;

  rc = nwGtpv1uProcessUlpReq(gtpv1u_data_pP->gtpv1u_stack, &ulp_req);

  if (rc == NW_GTPV1U_OK) {
    LOG_D(GTPU, "Successfully sent initial req for teid %u\n", teidP);
  } else {
    LOG_W(GTPU, "Could not send initial req for teid %u\n", teidP);
  }

  return (rc == NW_GTPV1U_OK) ? 0 : -1;
}
Пример #10
0
/*
 * Prints incoming byte stream in hexadecimal and readable form
 *
 * @param component Utilised as with macros defined in UTIL/LOG/log.h
 * @param data unsigned char* pointer for data buffer
 * @param size Number of octets in data buffer
 * @return none
 */
void util_print_hex_octets(comp_name_t component, unsigned char* data, unsigned long size)
{
  if (data == NULL) {
    LOG_W(component, "Incoming buffer is NULL! Ignoring...\n");
    return;
  }

  unsigned long octet_index = 0;

  LOG_D(component, "     |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |\n");
  LOG_D(component, "-----+-------------------------------------------------|\n");
  LOG_T(component, " 000 |");
  for (octet_index = 0; octet_index < size; ++octet_index) {
    /*
     * Print every single octet in hexadecimal form
     */
    LOG_T(component, " %02x", data[octet_index]);
    /*
     * Align newline and pipes according to the octets in groups of 2
     */
    if (octet_index != 0 && (octet_index + 1) % 16 == 0) {
      LOG_T(component, " |\n");
      LOG_T(component, " %03d |", octet_index);
    }
  }

  /*
   * Append enough spaces and put final pipe
   */
  unsigned char index;
  for (index = octet_index; index < 16; ++index)
    LOG_T(component, "   ");
  LOG_T(component, " |\n");
}
Пример #11
0
int Application::startup()
{
  // Already initialised!
  if(initialised)
  {
    LOG_W("Application startup", "Application already loaded!");
    return EXIT_SUCCESS;
  }

  // Set up SDL (create window and context for OpenGL)
  ASSERT(startSDL() == EXIT_SUCCESS, "Starting SDL");

  // Set up OpenGL/GLES "propre"
  ASSERT(startGL() == EXIT_SUCCESS, "Starting OpenGL/GLES");

  // Start up resource subsystems
  ASSERT(GraphicsManager::getInstance()->startup()
    == EXIT_SUCCESS, "Starting Graphics Manager");
  // Start the Audio Manager
  ASSERT(AudioManager::getInstance()->startup()
    == EXIT_SUCCESS, "Starting Audio Manager");
  // Start the Font Manager
  ASSERT(FontManager::getInstance()->startup()
    == EXIT_SUCCESS, "Starting Font Manager");

  // Load the initial scene
  ASSERT(scene->startup() == EXIT_SUCCESS, "Loading initial Scene");

  // Initialisation successful!
  initialised = true;
  return EXIT_SUCCESS;
}
Пример #12
0
int Application::shutdown()
{
  // Check if not initialised
  if(!initialised)
  {
    LOG_W("Application shutdown", "Application not loaded");
    return EXIT_SUCCESS;
  }

  // Close down the current scene
  ASSERT(scene->shutdown() == EXIT_SUCCESS, "Application shutting down Scene");
  delete scene;

  // Shut down subsystems
  AudioManager::getInstance()->shutdown();
  GraphicsManager::getInstance()->shutdown();

  // Destory application display and control structures
  SDL_GL_MakeCurrent(NULL, NULL);
  SDL_GL_DeleteContext(context);
  SDL_DestroyWindow(window);

	// Shut down SDL
	SDL_Quit();

	// Flag uninitialised and signal success
  initialised = false;
	return EXIT_SUCCESS;
}
Пример #13
0
static int32_t
__ldl_src_play(ldl_src *ldl)
{
	int32_t err = -EPERM;

	if (!lso || !lso->play)
		return err;

	if (ldl->state != OPENED)
		return err;

	LOG_I(
		"__ldl_src_play(): avs_media '%p'.", ldl
	);

	err = (*lso->play)((avs_media*)ldl);
	if (err)
	{
		LOG_W(
			"__ldl_src_play()->(*lso->play)() failed, err:'%d'.",
			err
		);
		return err;
	}
	else
	{
		LOG_I(
			"__ldl_src_play(): avs_media '%p' ok.", ldl
		);
	}

	return 0;
}
Пример #14
0
static int32_t
__ldl_src_ctrl(ldl_src *ldl, int32_t cmd, void *data)
{
	int32_t err = -EPERM;

	if (!lso || !lso->ctrl)
		return err;

	if (ldl->state != OPENED)
		return err;

	LOG_I(
		"__ldl_src_ctrl(): avs_media '%p'", ldl
	);

	err = (*lso->ctrl)((avs_media*)ldl, cmd, data);
	if (err)
	{
		LOG_W(
			"__ldl_src_ctrl()->(*lso->ctrl)() failed, err:'%d'.",
			err
		);
		return err;
	}
	else
	{
		LOG_I(
			"__ldl_src_ctrl(): avs_media '%p' ok.", ldl
		);
	}

	return 0;
}
Пример #15
0
static int32_t
__ldh_src_pause(ldh_src *ldh)
{
    int32_t err;

    if (ldh->state == OPENED || ldh->state == PLAYED)
    {
        if (!hso || !hso->pause)
        {
            ldh->state = PAUSED;
            return 0;
        }

        err = (*hso->pause)((avs_media*)ldh);
        if (err)
        {
            LOG_W(
                "__ldh_src_pause()->(*hso->pause)() failed, err:'%d'.",
                err
            );
        }
        else
        {
            ldh->state = PAUSED;
        }
        return err;
    }

    return 0;
}
Пример #16
0
static __inline__ int32_t
__ldh_src_play(ldh_src *ldh)
{
    int32_t err;

    if (ldh->state == CLOSED || ldh->state == PLAYED)
        return -EINVAL;

    if (!hso || !hso->play)
    {
        ldh->state = PLAYED;
        return 0;
    }

    err = (*hso->play)((avs_media*)ldh);
    if (err)
    {
        LOG_W(
            "__ldh_src_play()->(*hso->play)() failed, err:'%d'.",
            err
        );
        return err; 
    }

    ldh->state = PLAYED;
    return 0;
}
Пример #17
0
            bool SocketSession::deliver(const long fromId, const string message, const int type, const long mid){

                LOG_W(fromId, "SocketSession::deliver", type, message);
                // 国际化
                std::string i18nStr(message);
				LOG_DEBUG("SocketSession::deliver:: msg = "<<message);
				//cout<<getLang()<<endl;
                if (pack(getLang(), i18nStr)){
                    LOG_ERROR("SocketSession::response => I18nTranslate error msg=["<<message.c_str()<<"]");
                    LOG_W(fromId, "I18n::pack", type, "error");
                    return false;
                }

                MY_INSTANCE(SocketServer).deliverMsg(getConnectionId(), i18nStr );
				return 1;
			}
Пример #18
0
 bool HDDisk::setDevice ( PedDevice* p_device ) {
   if( p_device == nullptr ) {
     LOG_W() << "invalid PedDevice given... Abort!";
     return false;
   }
   
   if( c_device != nullptr ) {
     LOG_W() << "overwriting c_device " << c_device->path
             << " with p_device "       << p_device->path
             << "... okay, okay; will go on, but you are doing strange things, man!";
     ped_device_close( c_device );
   }
   
   c_device = p_device;
   return true;
 }
Пример #19
0
const action_t *action_get(const char *id)
{
    action_hash_item_t *item;
    HASH_FIND_STR(g_actions, id, item);
    if (!item) LOG_W("Cannot find action %s", id);
    return item ? item->action : NULL;
}
Пример #20
0
//-----------------------------------------------------------------------------
void
rb_free_rlc_union (
  void *rlcu_pP)
{
  //-----------------------------------------------------------------------------
  rlc_union_t * rlcu_p;

  if (rlcu_pP) {
    rlcu_p = (rlc_union_t *)(rlcu_pP);
    LOG_D(RLC,"%s %p \n",__FUNCTION__,rlcu_pP);

    switch (rlcu_p->mode) {
    case RLC_MODE_AM:
      rlc_am_cleanup(&rlcu_p->rlc.am);
      break;

    case RLC_MODE_UM:
      rlc_um_cleanup(&rlcu_p->rlc.um);
      break;

    case RLC_MODE_TM:
      rlc_tm_cleanup(&rlcu_p->rlc.tm);
      break;

    default:
      LOG_W(RLC,
            "%s %p unknown RLC type\n",
            __FUNCTION__,
            rlcu_pP);
      break;
    }
  }
}
Пример #21
0
static double getCpuUse(long num_cpu)
{
    static uint64_t prevIdleT = 0UL;

    FILE *f = fopen("/proc/stat", "re");
    if (f == NULL) {
        return NAN;
    }
    defer {
        fclose(f);
    };
    uint64_t userT, niceT, systemT, idleT; 
    if (fscanf
        (f, "cpu  %" PRIu64 "%" PRIu64 "%" PRIu64 "%" PRIu64, &userT, &niceT, &systemT,
         &idleT) != 4) {
        LOG_W("fscanf('/proc/stat') != 4");
        return NAN;
    }

    if (prevIdleT == 0UL) {
        prevIdleT = idleT;
        return NAN;
    }

    uint64_t cpuUse = (num_cpu * sysconf(_SC_CLK_TCK)) - (idleT - prevIdleT);
    prevIdleT = idleT;
    return (double)cpuUse / sysconf(_SC_CLK_TCK) * 100;
}
Пример #22
0
int Reactor::start(watcher_t *w)
{
	int fd = w->fd;
	if (fd < 0 || fd >= _watcher_pool_size) {
		LOG_W("fd is not valid");
		return -1;
	} 
	int ret = 0;
	watcher_t *_w = _wlist + fd;

	int cur_event = _w->event;

	_w->cb = w->cb;
	_w->event = w->event;
	_w->data = w->data;

	if (_w->active == 1) {
		//no need to modify if only cb change
		if (cur_event != w->event) {
			ret = _epollx->mod(_w);
		}
	} else {
		ret = _epollx->add(_w);
		_w->active = 1;
	}
	return ret;
}
Пример #23
0
GLuint GShader::compileShader(const char *shader, GLenum shaderType)
{
    GLuint shaderHandle = glCreateShader(shaderType);
    if (shaderHandle == 0)
    {
        return 0;
    }

    GLint shaderLength = (GLint)strlen(shader);
    glShaderSource(shaderHandle, 1, &shader, &shaderLength);
    glCompileShader(shaderHandle);

    GLint compileResult;
    glGetShaderiv(shaderHandle, GL_COMPILE_STATUS, &compileResult);
    if (compileResult == GL_FALSE)
    {
        GLchar message[2048];
        int len = 0;
        glGetShaderInfoLog(shaderHandle, sizeof(message), &len, &message[0]);
        LOG_W("<%s compile error>: %s", shader, message);
        glDeleteShader(shaderHandle);
        return 0;
    }
    return shaderHandle;
}
Пример #24
0
int main(int argc, char *argv[])
{
	struct nsjconf_t nsjconf;
	if (!cmdlineParse(argc, argv, &nsjconf)) {
		exit(1);
	}
	if (nsjconf.clone_newuser == false && geteuid() != 0) {
		LOG_W("--disable_clone_newuser requires root() privs");
	}
	if (nsjconf.daemonize && (daemon(0, 0) == -1)) {
		PLOG_F("daemon");
	}
	cmdlineLogParams(&nsjconf);
	if (nsjailSetSigHandlers() == false) {
		exit(1);
	}
	if (nsjailSetTimer() == false) {
		exit(1);
	}

	if (nsjconf.mode == MODE_LISTEN_TCP) {
		nsjailListenMode(&nsjconf);
	} else {
		return nsjailStandaloneMode(&nsjconf);
	}
	return 0;
}
Пример #25
0
bool Project::isScheduleResourceFeasible(const vector<int>& sts, const vector<int> &zr) const {
	for(int r = 0; r < numRes; r++)
		for(int t = 0; t < numPeriods; t++) {
			int cdem = 0;
			for(int j = 0; j < numJobs; j++) {
				if(sts[j] < t && t <= sts[j] + durations[j])
					cdem += demands(j, r);
			}
			if (cdem > capacities[r] + zr[r]) {
				LOG_W("Not enough residual capacity of resource = " + to_string(r) + " in period = " + to_string(t));
				LOG_W("Demand = " + to_string(cdem));
				LOG_W("Availability = " + to_string(capacities[r] + zr[r]));
				return false;
			}
		}
	return true;
}
Пример #26
0
vfs::Init::~Init()
{
    if (!PHYSFS_isInit()) {
        LOG_W("PhysFS already shut down.");
    } else if (!PHYSFS_deinit()) {
        LOG_E("PHYSFS_deinit failed: " + std::string(PHYSFS_getLastError()));
    }
}
Пример #27
0
void ldl_interfaces_test(media_uri *mrl)
{
	ldl_src *ldl;
	int32_t err;
	media_info msi;

	for (;;)
	{
		ldl = ldl_src_alloc(NULL);

		media_info_init(&msi);
		err = __ldl_src_probe(ldl, mrl, &msi);
		media_info_clear(&msi);

		if (err)
		{
			LOG_W(
				"ldl_interfaces_test()->__ldl_src_probe() failed, err:'%d'",
				err
			);
			goto test_failed;
		}

		err = __ldl_src_open(ldl, mrl);
		if (err)
		{
			LOG_W(
				"ldl_interfaces_test()->__ldl_src_open() failed, err:'%d'",
				err
			);
			goto test_failed;
		}

		__ldl_src_play(ldl);

		usleep(100*1000);
		__ldl_src_ctrl(ldl, 1, NULL);

		usleep(1000*1000);
		__ldl_src_kill(ldl);		

test_failed:
		media_src_kill_unref((media_src*)ldl);
		usleep(2000*1000);
	}
}
Пример #28
0
bool Project::isSchedulePrecedenceFeasible(const vector<int>& sts) const {
	for(int i = 0; i < numJobs; i++) {
		if (sts[i] < 0 || sts[i] + durations[i] > T) {
			LOG_W("Starting time of activity " + to_string(i) + " out of time horizon. t = " + to_string(sts[i]));
			return false;
		}

		for(int j = 0; j < numJobs; j++) {
			if (adjMx(i, j) && sts[i] + durations[i] > sts[j]) {
				LOG_W("Order feasibility violated. ft" + to_string(i) + "=" + to_string(sts[i] + durations[i]) + " > st" + to_string(j) + "=" + to_string(sts[j]));
				return false;
			}
		}
	}

	return true;
}
Пример #29
0
void signalHandler(int signal) {

	switch (signal) {

	case SIGHUP:
		LOG_W("Hungup signal received. Do something interesting");
		//TODO: Do something interesting.
		break;
	case SIGTERM:
		LOG_W("Teminate signal received. Quitting");

		terminate = true;

		//exit(EXIT_SUCCESS);
		break;

	}
}
Пример #30
0
static int32_t
__ldl_src_open(ldl_src *ldl, media_uri *mrl)
{
	int32_t err = -EPERM, ch, level;

	if (!lso || !lso->open)
		return err;

	if (ldl->state != INIT)
		return err;

	err = __parse_mrl(mrl, &ch, &level);
	if (err)
	{
		LOG_W(
			"__ldl_src_open()->__parse_mrl(%s) failed, err:'%d'.",
			__str(mrl), err
		);
		return err;
	}

	LOG_I(
		"__ldl_src_open(): mrl '%s'.", __str(mrl->mrl)
	);

	err = (*lso->open)((avs_media*)ldl, ch, level);
	if (err)
	{
		LOG_W(
			"__ldl_src_open()->(*lso->open)() failed, err:'%d'.",
			err
		);
		return err;	
	}
	else
	{
		LOG_I(
			"__ldl_src_open(): mrl '%s' ok.", __str(mrl->mrl)
		);
	}

	ldl->state = OPENED;
	return 0;
}