public bool doSceneResume(ChatMsg msg) { if (msg == null) { return(false); } string strClientMsgId = msg.strClientMsgId; Log.i("UploadVideoService", "cmd to scene resume, clientMsgId = " + strClientMsgId); if (UploadVideoContextMgr.getInstance().findByClientMsgID(strClientMsgId) != null) { Log.e("UploadVideoService", "already running,clean first. " + strClientMsgId); UploadVideoContextMgr.getInstance().clearnFinishedContext(); if (UploadVideoContextMgr.getInstance().findByClientMsgID(strClientMsgId) != null) { Log.e("UploadVideoService", "already running, ignored! clientMsgId = " + strClientMsgId); return(false); } } //if (!resumeByClientMsgID(msg)) //{ // return false; //} checkReadyContextDispatcher(); return(true); }
public bool doCancelScene(string clientMsgId) { UploadVideoContext context = UploadVideoContextMgr.getInstance().findByClientMsgID(clientMsgId); if (context == null) { Log.e("UploadVideoService", "not found clientMsgId= " + clientMsgId); return(false); } if ((context.mStatus == 5) || (context.mStatus == 4)) { Log.e("UploadVideoService", "wait to clean , clientMsgId= " + clientMsgId); return(false); } //if (context.mSceneHandle == null) //{ // Log.e("UploadVideoService", "task not runing, clientMsgId= " + clientMsgId); // context.mStatus = 4; // context.updateContext(); // context.onFinished(); // return false; //} //context.mSceneHandle.doCancel(); return(true); }
public static void onVideoContextDispatcher(object sender, EventArgs e) { UploadVideoContextMgr.getInstance().clearnFinishedContext(); if (UploadVideoContextMgr.getInstance().getCount() <= 0) { closeDispatcherTimer(); } else if (UploadVideoContextMgr.getInstance().countRunningContext() < MAX_RUNNING) { UploadVideoContext videoContext = UploadVideoContextMgr.getInstance().getFirstContextNeedHandle(); if (videoContext != null) { //Log.i("UploadVideoService", "new task startup, clientmsgid = " + videoContext.mVideoTrans.strClientMsgId); //if (videoContext.mChatMsg.nMsgType == 0x3e) //{ // //new NetSceneUploadCdnVideo().doScene(videoContext); //} //else if (CDNComService.Instance.isUseCdnComSendVideo && CDNComService.Instance.isCdnSupportToUser(videoContext.mVideoTrans.strToUserName)) //{ // // new NetSceneUploadCdnVideo().doScene(videoContext); //} //else //{ new NetSceneUploadVideo().doScene(videoContext); // } } } }
public static UploadVideoContextMgr getInstance() { if (gContextMgr == null) { gContextMgr = new UploadVideoContextMgr(); } return(gContextMgr); }
public bool doSenceShortVideo(string toUserName, string videoFile, string thumbFile, int playLength, bool isForward = false, ChatMsg origChatMsg = null) { Log.i("UploadVideoService", "begin up short video, videoFile = " + videoFile); string hashString = MD5Core.GetHashString(toUserName + Util.getNowMilliseconds()); UploadVideoContext context = UploadVideoContext.createByClientMsgID(hashString); if (context == null) { Log.e("UploadVideoService", "create upload short video context failed. "); return(false); } Log.i("UploadVideoService", "cmd to scene begin, toUserName = "******" , clientMsgId = " + hashString); context.mVideoTrans.strToUserName = toUserName; context.mVideoTrans.strFromUserName = AccountMgr.getCurAccount().strUsrName; context.mVideoTrans.strThumbnail = thumbFile; context.mVideoTrans.strImagePath = videoFile; context.mVideoTrans.nDuration = playLength; context.mStatus = 0; if (isForward) { //context.preProcessSightFile(thumbFile, videoFile); context.mOrigChatMsg = origChatMsg; } if (!context.initThumbMemStream()) { Log.e("UploadVideoService", "failed to load thumb file. "); return(false); } if (!context.initVideoFileStream()) { Log.e("UploadVideoService", "failed to load video file. "); return(false); } context.addVoiceChatMsg(true); UploadVideoContextMgr.getInstance().putToHead(context); checkReadyContextDispatcher(); return(true); }
private static void closeDispatcherTimer() { if (mTimerObject != null) { mTimerObject.stop(); mTimerObject = null; Log.d("UploadVideoService", "all ready, close dispatcher timer. null "); } Log.d("UploadVideoService", "all ready, close dispatcher timer. count " + UploadVideoContextMgr.getInstance().getCount()); }