1 /* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18 19 #ifndef PV_INTERFACE_PROXY_H_INCLUDED 20 #include "pv_interface_proxy.h" 21 #endif 22 23 #ifndef PV_INTERFACE_PROXY_NOTIFIER_H_INCLUDED 24 #include "pv_interface_proxy_notifier.h" 25 #endif 26 27 void CPVInterfaceProxyNotifier::Run() 28 { 29 if (Status() != OSCL_REQUEST_ERR_NONE) 30 return; 31 32 CPVProxyMsg notice(0, 0, NULL); 33 34 //Enter critical section... 35 iProxy->iNotifierQueueCrit.Lock(); 36 37 //check notice queue... 38 if (iProxy->iNotificationQueue.size() > 0) 39 { 40 notice = iProxy->iNotificationQueue[0]; 41 iProxy->iNotificationQueue.erase(&iProxy->iNotificationQueue[0]); 42 } 43 44 PendForExec(); 45 46 //if there's another message queued, 47 //go ahead and signal request complete. 48 if (iProxy->iNotificationQueue.size() > 0) 49 PendComplete(OSCL_REQUEST_ERR_NONE); 50 51 //Leave critical section... 52 iProxy->iNotifierQueueCrit.Unlock(); 53 54 //Process the notice 55 if (notice.iMsg) 56 { 57 //call proxy client message handler. 58 CPVProxyInterface *proxy = iProxy->FindInterface(notice.iProxyId); 59 if (proxy) 60 proxy->iClient->HandleNotification(notice.iMsgId, notice.iMsg); 61 else 62 OSCL_ASSERT(0);//debug error. 63 } 64 65 } 66