• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef PVMF_JB_EVENT_NOTIFIER_H
19 #include "pvmf_jb_event_notifier.h"
20 #endif
21 
22 
New(PVMFMediaClock & aNonDecreasingClock,PVMFMediaClock & aClientPlaybackClock,PVMFMediaClock & aEstimatedServerClock)23 OSCL_EXPORT_REF PVMFJBEventNotifier* PVMFJBEventNotifier::New(PVMFMediaClock& aNonDecreasingClock, PVMFMediaClock& aClientPlaybackClock, PVMFMediaClock& aEstimatedServerClock)
24 {
25     PVMFJBEventNotifier* ptr = NULL;
26     int32 err = OsclErrNone;
27     OSCL_TRY(err, ptr = OSCL_NEW(PVMFJBEventNotifier, (aNonDecreasingClock, aClientPlaybackClock, aEstimatedServerClock));
28              ptr->Construct(););
29     if (err != OsclErrNone && ptr)
30     {
31         OSCL_DELETE(ptr);
32         ptr = NULL;
33     }
34     return ptr;
35 }
36 
Construct()37 void PVMFJBEventNotifier::Construct()
38 {
39     ipLogger = PVLogger::GetLoggerObject("PVMFJBEventNotifier");
40     int32 err = OsclErrNone;
41     OSCL_TRY(err,
42 
43              ipNonDecreasingClkNotificationInterfaceObserver = OSCL_NEW(NonDecClkNotificationInterfaceObserver, (iJBEvntNtfrRequestInfoVectNonDecClk));
44              ipClientPlaybackClkNotificationInterfaceObserver = OSCL_NEW(ClientPlaybackClkNotificationInterfaceObserver, (iJBEvntNtfrRequestInfoVectClientPlaybackClk));
45              ipEstimatedSrvrClkNotificationInterfaceObserver = OSCL_NEW(EstimatedSrvrClkNotificationInterfaceObserver, (iJBEvntNtfrRequestInfoVectEstimatedServClk));
46 
47              irNonDecreasingClock.ConstructMediaClockNotificationsInterface(ipNonDecreasingClockNotificationsInf, *ipNonDecreasingClkNotificationInterfaceObserver);
48              irClientPlaybackClock.ConstructMediaClockNotificationsInterface(ipClientPlayBackClockNotificationsInf, *ipClientPlaybackClkNotificationInterfaceObserver);
49              irEstimatedServerClock.ConstructMediaClockNotificationsInterface(ipEstimatedClockNotificationsInf, *ipEstimatedSrvrClkNotificationInterfaceObserver);
50 
51             );
52 
53     if (err != OsclErrNone || ((NULL == ipNonDecreasingClockNotificationsInf) || (NULL == ipClientPlayBackClockNotificationsInf) || (NULL == ipEstimatedClockNotificationsInf)))
54     {
55         CleanUp();
56     }
57 }
58 
~PVMFJBEventNotifier()59 OSCL_EXPORT_REF PVMFJBEventNotifier::~PVMFJBEventNotifier()
60 {
61     CleanUp();
62 }
63 
CleanUp()64 void PVMFJBEventNotifier::CleanUp()
65 {
66     CancelAllPendingCallbacks();
67 
68     PVMF_JB_LOGEVENTNOTIFIER((0, "Est clock Vect Size %d", iJBEvntNtfrRequestInfoVectEstimatedServClk.size()));
69     PVMF_JB_LOGEVENTNOTIFIER((0, "Client clock Vect Size %d", iJBEvntNtfrRequestInfoVectClientPlaybackClk.size()));
70     PVMF_JB_LOGEVENTNOTIFIER((0, "Non dec clock Vect Size %d", iJBEvntNtfrRequestInfoVectNonDecClk.size()));
71 
72     if (ipEstimatedClockNotificationsInf)
73     {
74         irEstimatedServerClock.DestroyMediaClockNotificationsInterface(ipEstimatedClockNotificationsInf);
75         ipEstimatedClockNotificationsInf = NULL;
76     }
77 
78     if (ipClientPlayBackClockNotificationsInf)
79     {
80         irClientPlaybackClock.DestroyMediaClockNotificationsInterface(ipClientPlayBackClockNotificationsInf);
81         ipClientPlayBackClockNotificationsInf = NULL;
82     }
83 
84     if (ipNonDecreasingClockNotificationsInf)
85     {
86         irNonDecreasingClock.DestroyMediaClockNotificationsInterface(ipNonDecreasingClockNotificationsInf);
87         ipNonDecreasingClockNotificationsInf = NULL;
88     }
89 
90     if (ipNonDecreasingClkNotificationInterfaceObserver)
91     {
92         OSCL_DELETE(ipNonDecreasingClkNotificationInterfaceObserver);
93     }
94 
95     if (ipClientPlaybackClkNotificationInterfaceObserver)
96     {
97         OSCL_DELETE(ipClientPlaybackClkNotificationInterfaceObserver);
98     }
99 
100     if (ipEstimatedSrvrClkNotificationInterfaceObserver)
101     {
102         OSCL_DELETE(ipEstimatedSrvrClkNotificationInterfaceObserver);
103     }
104 }
105 
RequestCallBack(const PVMFJBEventNotificationRequestInfo & aNotificationRequestInfo,uint32 aDelay,uint32 & aCallBkId)106 OSCL_EXPORT_REF bool PVMFJBEventNotifier::RequestCallBack(const PVMFJBEventNotificationRequestInfo& aNotificationRequestInfo, uint32 aDelay, uint32& aCallBkId)
107 {
108     PVMF_JB_LOGEVENTNOTIFIER((0, "PVMFJBEventNotifier::RequestCallBack In - Interface type[%d] Observer[0x%x] aDelay[%d]", aNotificationRequestInfo.GetMediaClockNotificationsInterfaceType(), aNotificationRequestInfo.GetObserver() , aDelay));
109     bool retval = false;
110     CLOCK_NOTIFICATION_INTF_TYPE interfaceType = aNotificationRequestInfo.GetMediaClockNotificationsInterfaceType();
111     PVMFMediaClockNotificationsInterface* eventNotificationInterface = NULL;
112     PVMFMediaClockNotificationsObs* callbackObserver = NULL;
113     Oscl_Vector<PVMFJBEventNotifierRequestInfo*, OsclMemAllocator>* jbEvntNtfrRequestInfoVect = NULL;
114 
115     switch (interfaceType)
116     {
117         case CLOCK_NOTIFICATION_INTF_TYPE_NONDECREASING:
118         {
119             //Make sure clock is in running state
120             if (irNonDecreasingClock.GetState() != PVMFMediaClock::RUNNING)
121             {
122                 return false;
123             }
124 
125             eventNotificationInterface = ipNonDecreasingClockNotificationsInf;
126             jbEvntNtfrRequestInfoVect = &iJBEvntNtfrRequestInfoVectNonDecClk;
127             callbackObserver = ipNonDecreasingClkNotificationInterfaceObserver;
128         }
129         break;
130         case CLOCK_NOTIFICATION_INTF_TYPE_CLIENTPLAYBACK:
131         {
132             //Make sure clock is in running state
133             if (irClientPlaybackClock.GetState() != PVMFMediaClock::RUNNING)
134             {
135                 return false;
136             }
137             eventNotificationInterface  = ipClientPlayBackClockNotificationsInf;
138             jbEvntNtfrRequestInfoVect = &iJBEvntNtfrRequestInfoVectClientPlaybackClk;
139             callbackObserver = ipClientPlaybackClkNotificationInterfaceObserver;
140         }
141         break;
142         case CLOCK_NOTIFICATION_INTF_TYPE_ESTIMATEDSERVER:
143         {
144             //Make sure clock is in running state
145             if (irEstimatedServerClock.GetState() != PVMFMediaClock::RUNNING)
146             {
147                 return false;
148             }
149             eventNotificationInterface = ipEstimatedClockNotificationsInf;
150             jbEvntNtfrRequestInfoVect = &iJBEvntNtfrRequestInfoVectEstimatedServClk;
151             callbackObserver = ipEstimatedSrvrClkNotificationInterfaceObserver;
152         }
153         break;
154         default:
155         {
156             OSCL_ASSERT(false);
157         }
158     }
159 
160     if (eventNotificationInterface && callbackObserver && aDelay > 0)
161     {
162         const int32 toleranceWndForCallback = 0;
163         PVMFStatus status = eventNotificationInterface->SetCallbackDeltaTime(aDelay, //delta time in clock when callBack should be called
164                             toleranceWndForCallback,
165                             callbackObserver, //observer object to be called on timeout
166                             false, //no threadLock
167                             aNotificationRequestInfo.GetContextData(), //no context
168                             aCallBkId); //ID used to identify the timer for cancellation
169         if (PVMFSuccess != status)
170         {
171             OSCL_ASSERT(false);
172         }
173         else
174         {
175             //Replicate aNotificationRequestInfo
176             PVMFJBEventNotifierRequestInfo *notifierReqInfo = OSCL_NEW(PVMFJBEventNotifierRequestInfo, ());
177             if (notifierReqInfo)
178             {
179                 PVMFJBEventNotificationRequestInfo* obsRequestInfo = OSCL_NEW(PVMFJBEventNotificationRequestInfo, (aNotificationRequestInfo));
180                 notifierReqInfo->ipRequestInfo = obsRequestInfo;
181                 notifierReqInfo->iCallBackId = aCallBkId;
182                 jbEvntNtfrRequestInfoVect->push_back(notifierReqInfo);
183                 retval = true;
184             }
185             PVMF_JB_LOGEVENTNOTIFIER((0, "PVMFJBEventNotifier::RequestCallBack - Allocated at 0x%x", notifierReqInfo));
186         }
187     }
188     else
189     {
190         OSCL_ASSERT(false);
191     }
192 
193     PVMF_JB_LOGEVENTNOTIFIER((0, "PVMFJBEventNotifier::RequestCallBack Out - retval[%d] Interface type[%d] Observer[0x%x] aDelay[%d], aCallBkId[%d]", retval, aNotificationRequestInfo.GetMediaClockNotificationsInterfaceType(), aNotificationRequestInfo.GetObserver() , aDelay, aCallBkId));
194     return retval;
195 }
196 
RequestAbsoluteTimeCallBack(const PVMFJBEventNotificationRequestInfo & aNotificationRequestInfo,uint32 aAbsoluteTime,uint32 & aCallBkId)197 OSCL_EXPORT_REF bool PVMFJBEventNotifier::RequestAbsoluteTimeCallBack(const PVMFJBEventNotificationRequestInfo& aNotificationRequestInfo, uint32 aAbsoluteTime, uint32& aCallBkId)
198 {
199     PVMF_JB_LOGEVENTNOTIFIER((0, "PVMFJBEventNotifier::RequestAbsoluteTimeCallBack In - Interface type[%d] Observer[0x%x] aAbsoluteTime[%d]", aNotificationRequestInfo.GetMediaClockNotificationsInterfaceType(), aNotificationRequestInfo.GetObserver() , aAbsoluteTime));
200     bool retval = false;
201     CLOCK_NOTIFICATION_INTF_TYPE interfaceType = aNotificationRequestInfo.GetMediaClockNotificationsInterfaceType();
202     PVMFMediaClockNotificationsInterface* eventNotificationInterface = NULL;
203     PVMFMediaClockNotificationsObs* callbackObserver = NULL;
204     Oscl_Vector<PVMFJBEventNotifierRequestInfo*, OsclMemAllocator>* jbEvntNtfrRequestInfoVect = NULL;
205 
206     switch (interfaceType)
207     {
208         case CLOCK_NOTIFICATION_INTF_TYPE_NONDECREASING:
209         {
210             //Make sure clock is in running state
211             if (irNonDecreasingClock.GetState() != PVMFMediaClock::RUNNING)
212             {
213                 return false;
214             }
215 
216             eventNotificationInterface = ipNonDecreasingClockNotificationsInf;
217             jbEvntNtfrRequestInfoVect = &iJBEvntNtfrRequestInfoVectNonDecClk;
218             callbackObserver = ipNonDecreasingClkNotificationInterfaceObserver;
219         }
220         break;
221         case CLOCK_NOTIFICATION_INTF_TYPE_CLIENTPLAYBACK:
222         {
223             //Make sure clock is in running state
224             if (irClientPlaybackClock.GetState() != PVMFMediaClock::RUNNING)
225             {
226                 return false;
227             }
228             eventNotificationInterface  = ipClientPlayBackClockNotificationsInf;
229             jbEvntNtfrRequestInfoVect = &iJBEvntNtfrRequestInfoVectClientPlaybackClk;
230             callbackObserver = ipClientPlaybackClkNotificationInterfaceObserver;
231         }
232         break;
233         case CLOCK_NOTIFICATION_INTF_TYPE_ESTIMATEDSERVER:
234         {
235             //Make sure clock is in running state
236             if (irEstimatedServerClock.GetState() != PVMFMediaClock::RUNNING)
237             {
238                 return false;
239             }
240             eventNotificationInterface = ipEstimatedClockNotificationsInf;
241             jbEvntNtfrRequestInfoVect = &iJBEvntNtfrRequestInfoVectEstimatedServClk;
242             callbackObserver = ipEstimatedSrvrClkNotificationInterfaceObserver;
243         }
244         break;
245         default:
246         {
247             OSCL_ASSERT(false);
248         }
249     }
250 
251     if (eventNotificationInterface && callbackObserver && aAbsoluteTime > 0)
252     {
253         const int32 toleranceWndForCallback = 0;
254         PVMFStatus status = eventNotificationInterface->SetCallbackAbsoluteTime(aAbsoluteTime,
255                             toleranceWndForCallback,
256                             callbackObserver, //observer object to be called on timeout
257                             false, //no threadLock
258                             aNotificationRequestInfo.GetContextData(), //no context
259                             aCallBkId); //ID used to identify the timer for cancellation
260         if (PVMFSuccess != status)
261         {
262             OSCL_ASSERT(false);
263         }
264         else
265         {
266             //Replicate aNotificationRequestInfo
267             PVMFJBEventNotifierRequestInfo *notifierReqInfo = OSCL_NEW(PVMFJBEventNotifierRequestInfo, ());
268             if (notifierReqInfo)
269             {
270                 PVMFJBEventNotificationRequestInfo* obsRequestInfo = OSCL_NEW(PVMFJBEventNotificationRequestInfo, (aNotificationRequestInfo));
271                 notifierReqInfo->ipRequestInfo = obsRequestInfo;
272                 notifierReqInfo->iCallBackId = aCallBkId;
273                 jbEvntNtfrRequestInfoVect->push_back(notifierReqInfo);
274                 retval = true;
275             }
276         }
277     }
278     else
279     {
280         OSCL_ASSERT(false);
281     }
282 
283     PVMF_JB_LOGEVENTNOTIFIER((0, "PVMFJBEventNotifier::RequestCallBack Out - retval[%d] Interface type[%d] Observer[0x%x] aAbsoluteTime[%d], aCallBkId[%d]", retval, aNotificationRequestInfo.GetMediaClockNotificationsInterfaceType(), aNotificationRequestInfo.GetObserver() , aAbsoluteTime, aCallBkId));
284     return retval;
285 }
286 
CancelCallBack(const PVMFJBEventNotificationRequestInfo & aNotificationRequestInfo,uint32 aCallBkId)287 OSCL_EXPORT_REF void PVMFJBEventNotifier::CancelCallBack(const PVMFJBEventNotificationRequestInfo& aNotificationRequestInfo, uint32 aCallBkId)
288 {
289     PVMF_JB_LOGEVENTNOTIFIER((0, "PVMFJBEventNotifier::CancelCallBack In - Interface type[%d] Observer[0x%x] aCallBkId[%d]", aNotificationRequestInfo.GetMediaClockNotificationsInterfaceType(), aNotificationRequestInfo.GetObserver() , aCallBkId));
290     CancelCallBack(aNotificationRequestInfo.GetMediaClockNotificationsInterfaceType(), aNotificationRequestInfo.GetObserver(), aCallBkId);
291 }
292 
CancelCallBack(CLOCK_NOTIFICATION_INTF_TYPE aType,PVMFJBEventNotifierObserver * aObserver,uint32 & aCallBkId)293 void PVMFJBEventNotifier::CancelCallBack(CLOCK_NOTIFICATION_INTF_TYPE aType, PVMFJBEventNotifierObserver* aObserver, uint32& aCallBkId)
294 {
295     OSCL_UNUSED_ARG(aObserver);
296     PVMFMediaClockNotificationsInterface* eventNotificationInterface = NULL;
297     Oscl_Vector<PVMFJBEventNotifierRequestInfo*, OsclMemAllocator>* jbEvntNtfrRequestInfoVect = NULL;
298 
299     switch (aType)
300     {
301         case CLOCK_NOTIFICATION_INTF_TYPE_NONDECREASING:
302         {
303             eventNotificationInterface = ipNonDecreasingClockNotificationsInf;
304             jbEvntNtfrRequestInfoVect = &iJBEvntNtfrRequestInfoVectNonDecClk;
305         }
306         break;
307         case CLOCK_NOTIFICATION_INTF_TYPE_CLIENTPLAYBACK:
308         {
309             eventNotificationInterface  = ipClientPlayBackClockNotificationsInf;
310             jbEvntNtfrRequestInfoVect = &iJBEvntNtfrRequestInfoVectClientPlaybackClk;
311         }
312         break;
313         case CLOCK_NOTIFICATION_INTF_TYPE_ESTIMATEDSERVER:
314         {
315             eventNotificationInterface = ipEstimatedClockNotificationsInf;
316             jbEvntNtfrRequestInfoVect = &iJBEvntNtfrRequestInfoVectEstimatedServClk;
317         }
318         break;
319         default:
320         {
321             OSCL_ASSERT(false);
322         }
323     }
324 
325     if (eventNotificationInterface && jbEvntNtfrRequestInfoVect)
326     {
327         eventNotificationInterface->CancelCallback(aCallBkId, false);
328         Oscl_Vector<PVMFJBEventNotifierRequestInfo*, OsclMemAllocator>::iterator iter;
329         if (jbEvntNtfrRequestInfoVect->size())
330         {
331             for (iter = jbEvntNtfrRequestInfoVect->end() - 1; iter >= jbEvntNtfrRequestInfoVect->begin(); iter--)
332             {
333                 PVMFJBEventNotifierRequestInfo* eventNotifierReqinfo = *iter;
334                 if (aCallBkId == eventNotifierReqinfo->iCallBackId)
335                 {
336                     OSCL_DELETE(eventNotifierReqinfo->ipRequestInfo);
337                     OSCL_DELETE(eventNotifierReqinfo);
338                     PVMF_JB_LOGEVENTNOTIFIER((0, "PVMFJBEventNotifier::RequestCallBack - Dellocated at 0x%x", eventNotifierReqinfo));
339                     jbEvntNtfrRequestInfoVect->erase(iter);
340                     break;
341                 }
342             }
343         }
344     }
345 }
346 
CancelAllPendingCallbacks(CLOCK_NOTIFICATION_INTF_TYPE aType,PVMFJBEventNotifierObserver * aObserver)347 OSCL_EXPORT_REF void PVMFJBEventNotifier::CancelAllPendingCallbacks(CLOCK_NOTIFICATION_INTF_TYPE aType, PVMFJBEventNotifierObserver* aObserver)
348 {
349     Oscl_Vector<PVMFJBEventNotifierRequestInfo*, OsclMemAllocator>* jbEvntNtfrRequestInfoVect = NULL;
350     switch (aType)
351     {
352         case CLOCK_NOTIFICATION_INTF_TYPE_NONDECREASING:
353         {
354             jbEvntNtfrRequestInfoVect = &iJBEvntNtfrRequestInfoVectNonDecClk;
355         }
356         break;
357         case CLOCK_NOTIFICATION_INTF_TYPE_CLIENTPLAYBACK:
358         {
359             jbEvntNtfrRequestInfoVect = &iJBEvntNtfrRequestInfoVectClientPlaybackClk;
360         }
361         break;
362         case CLOCK_NOTIFICATION_INTF_TYPE_ESTIMATEDSERVER:
363         {
364             jbEvntNtfrRequestInfoVect = &iJBEvntNtfrRequestInfoVectEstimatedServClk;
365         }
366         break;
367         default:
368         {
369             OSCL_ASSERT(false);
370         }
371     }
372 
373     if (jbEvntNtfrRequestInfoVect)
374     {
375         Oscl_Vector<PVMFJBEventNotifierRequestInfo*, OsclMemAllocator>::iterator iter;
376         if (jbEvntNtfrRequestInfoVect->size())
377         {
378             for (iter = jbEvntNtfrRequestInfoVect->end() - 1; iter >= jbEvntNtfrRequestInfoVect->begin(); iter--)
379             {
380                 PVMFJBEventNotifierRequestInfo* ptr = *iter;
381                 CancelCallBack(aType, aObserver, ptr->iCallBackId);
382             }
383         }
384     }
385 }
386 
CancelAllPendingCallbacks()387 OSCL_EXPORT_REF void PVMFJBEventNotifier::CancelAllPendingCallbacks()
388 {
389     CancelAllPendingCallbacks(CLOCK_NOTIFICATION_INTF_TYPE_NONDECREASING);
390     CancelAllPendingCallbacks(CLOCK_NOTIFICATION_INTF_TYPE_CLIENTPLAYBACK);
391     CancelAllPendingCallbacks(CLOCK_NOTIFICATION_INTF_TYPE_ESTIMATEDSERVER);
392 }
393 
394 ///////////////////////////////////////////////////////////////////////////////
395 //NonDecClkNotificationInterfaceObserver
396 ///////////////////////////////////////////////////////////////////////////////
ProcessCallBack(uint32 aCallBackID,PVTimeComparisonUtils::MediaTimeStatus aTimerAccuracy,uint32 aDelta,const OsclAny * aContextData,PVMFStatus aStatus)397 void NonDecClkNotificationInterfaceObserver::ProcessCallBack(uint32 aCallBackID, PVTimeComparisonUtils::MediaTimeStatus aTimerAccuracy, uint32 aDelta, const OsclAny* aContextData, PVMFStatus aStatus)
398 {
399     OSCL_UNUSED_ARG(aTimerAccuracy);
400     OSCL_UNUSED_ARG(aDelta);
401     bool found = false;
402     Oscl_Vector<PVMFJBEventNotifierRequestInfo*, OsclMemAllocator>::iterator iter;
403     PVMFJBEventNotifierRequestInfo* eventNotifierReqinfo = NULL;
404 
405     for (iter = irJBEvntNtfrRequestInfoVectNonDecClk.begin(); iter != irJBEvntNtfrRequestInfoVectNonDecClk.end(); iter++)
406     {
407         eventNotifierReqinfo = *iter;
408         if (aCallBackID == eventNotifierReqinfo->iCallBackId)
409         {
410             found = true;
411             break;
412         }
413     }
414     if (found && eventNotifierReqinfo)
415     {
416 
417         PVMFJBEventNotifierObserver* observer = eventNotifierReqinfo->ipRequestInfo->GetObserver();
418         OSCL_DELETE(eventNotifierReqinfo->ipRequestInfo);
419         OSCL_DELETE(eventNotifierReqinfo);
420         PVMF_JB_LOGEVENTNOTIFIER((0, "PVMFJBEventNotifier::RequestCallBack - Dellocated at 0x%x", eventNotifierReqinfo));
421         irJBEvntNtfrRequestInfoVectNonDecClk.erase(iter);
422         observer->ProcessCallback(CLOCK_NOTIFICATION_INTF_TYPE_NONDECREASING, aCallBackID, aContextData, aStatus);
423     }
424     else
425         OSCL_ASSERT(false);
426 }
427 
NotificationsInterfaceDestroyed()428 void NonDecClkNotificationInterfaceObserver::NotificationsInterfaceDestroyed()
429 {
430 
431 }
432 
433 ///////////////////////////////////////////////////////////////////////////////
434 //ClientPlaybackClkNotificationInterfaceObserver
435 ///////////////////////////////////////////////////////////////////////////////
ProcessCallBack(uint32 aCallBackID,PVTimeComparisonUtils::MediaTimeStatus aTimerAccuracy,uint32 aDelta,const OsclAny * aContextData,PVMFStatus aStatus)436 void ClientPlaybackClkNotificationInterfaceObserver::ProcessCallBack(uint32 aCallBackID, PVTimeComparisonUtils::MediaTimeStatus aTimerAccuracy, uint32 aDelta, const OsclAny* aContextData, PVMFStatus aStatus)
437 {
438     OSCL_UNUSED_ARG(aTimerAccuracy);
439     OSCL_UNUSED_ARG(aDelta);
440     bool found = false;
441     Oscl_Vector<PVMFJBEventNotifierRequestInfo*, OsclMemAllocator>::iterator iter;
442     PVMFJBEventNotifierRequestInfo* eventNotifierReqinfo = NULL;
443     for (iter = irJBEvntNtfrRequestInfoVectClientPlaybackClk.begin(); iter != irJBEvntNtfrRequestInfoVectClientPlaybackClk.end(); iter++)
444     {
445         eventNotifierReqinfo = *iter;
446         if (aCallBackID == eventNotifierReqinfo->iCallBackId)
447         {
448             found = true;
449             break;
450         }
451     }
452     if (found && eventNotifierReqinfo)
453     {
454         PVMFJBEventNotifierObserver* observer = eventNotifierReqinfo->ipRequestInfo->GetObserver();
455         OSCL_DELETE(eventNotifierReqinfo->ipRequestInfo);
456         OSCL_DELETE(eventNotifierReqinfo);
457         PVMF_JB_LOGEVENTNOTIFIER((0, "PVMFJBEventNotifier::RequestCallBack - Dellocated at 0x%x", eventNotifierReqinfo));
458         irJBEvntNtfrRequestInfoVectClientPlaybackClk.erase(iter);
459         observer->ProcessCallback(CLOCK_NOTIFICATION_INTF_TYPE_CLIENTPLAYBACK, aCallBackID, aContextData, aStatus);
460     }
461     else
462         OSCL_ASSERT(false);
463 }
464 
NotificationsInterfaceDestroyed()465 void ClientPlaybackClkNotificationInterfaceObserver::NotificationsInterfaceDestroyed()
466 {
467 
468 }
469 
470 ///////////////////////////////////////////////////////////////////////////////
471 //EstimatedSrvrClkNotificationInterfaceObserver
472 ///////////////////////////////////////////////////////////////////////////////
ProcessCallBack(uint32 aCallBackID,PVTimeComparisonUtils::MediaTimeStatus aTimerAccuracy,uint32 aDelta,const OsclAny * aContextData,PVMFStatus aStatus)473 void EstimatedSrvrClkNotificationInterfaceObserver::ProcessCallBack(uint32 aCallBackID, PVTimeComparisonUtils::MediaTimeStatus aTimerAccuracy, uint32 aDelta, const OsclAny* aContextData, PVMFStatus aStatus)
474 {
475     OSCL_UNUSED_ARG(aTimerAccuracy);
476     OSCL_UNUSED_ARG(aDelta);
477     bool found = false;
478     Oscl_Vector<PVMFJBEventNotifierRequestInfo*, OsclMemAllocator>::iterator iter;
479     PVMFJBEventNotifierRequestInfo* eventNotifierReqinfo = NULL;
480     for (iter = irJBEvntNtfrRequestInfoVectEstimatedServClk.begin(); iter != irJBEvntNtfrRequestInfoVectEstimatedServClk.end(); iter++)
481     {
482         eventNotifierReqinfo = *iter;
483         if (aCallBackID == eventNotifierReqinfo->iCallBackId)
484         {
485             found = true;
486             break;
487         }
488     }
489     if (found && eventNotifierReqinfo)
490     {
491         PVMFJBEventNotifierObserver* observer = eventNotifierReqinfo->ipRequestInfo->GetObserver();
492         OSCL_DELETE(eventNotifierReqinfo->ipRequestInfo);
493         OSCL_DELETE(eventNotifierReqinfo);
494         PVMF_JB_LOGEVENTNOTIFIER((0, "PVMFJBEventNotifier::RequestCallBack - Dellocated at 0x%x", eventNotifierReqinfo));
495         irJBEvntNtfrRequestInfoVectEstimatedServClk.erase(iter);
496         observer->ProcessCallback(CLOCK_NOTIFICATION_INTF_TYPE_ESTIMATEDSERVER, aCallBackID, aContextData, aStatus);
497     }
498     else
499         OSCL_ASSERT(false);
500 }
501 
NotificationsInterfaceDestroyed()502 void EstimatedSrvrClkNotificationInterfaceObserver::NotificationsInterfaceDestroyed()
503 {
504 
505 }
506