Commit f459870b authored by Ghislain MARY's avatar Ghislain MARY

Handle average fps computation.

parent 0fdfa681
......@@ -118,6 +118,7 @@ int MSWinRTCap::activate()
{
if (!mIsInitialized) return -1;
ms_average_fps_init(&mAvgFps, "[MSWinRTCap] fps=%f");
mCapture = ref new MediaCapture();
MediaCaptureInitializationSettings^ initSettings = ref new MediaCaptureInitializationSettings();
initSettings->MediaCategory = MediaCategory::Communications;
......@@ -250,6 +251,7 @@ int MSWinRTCap::feed(MSFilter *f)
// Send queued samples
while ((im = ms_queue_get(&mSampleToSendQueue)) != NULL) {
ms_queue_put(f->outputs[0], im);
ms_average_fps_update(&mAvgFps, f->ticker->time);
}
ms_mutex_unlock(&mMutex);
......@@ -285,6 +287,11 @@ void MSWinRTCap::setFps(float fps)
applyFps();
}
float MSWinRTCap::getAverageFps()
{
return ms_average_fps_get(&mAvgFps);
}
MSVideoSize MSWinRTCap::getVideoSize()
{
MSVideoSize vs;
......
......@@ -59,6 +59,7 @@ namespace libmswinrtvid
void setDeviceId(Platform::String^ id) { mDeviceId = id; };
MSPixFmt getPixFmt() { return MS_YUV420P; }
float getFps() { return mFps; }
float getAverageFps();
void setFps(float fps);
MSVideoSize getVideoSize();
void setVideoSize(MSVideoSize vs);
......@@ -81,6 +82,7 @@ namespace libmswinrtvid
bool mIsActivated;
bool mIsStarted;
float mFps;
MSAverageFPS mAvgFps;
MSVideoSize mVideoSize;
MSQueue mSampleToSendQueue;
MSQueue mSampleToFreeQueue;
......
......@@ -78,7 +78,11 @@ static void ms_winrtcap_read_uninit(MSFilter *f) {
static int ms_winrtcap_get_fps(MSFilter *f, void *arg) {
MSWinRTCap *r = static_cast<MSWinRTCap *>(f->data);
*((float *)arg) = r->getFps();
if (f->ticker) {
*((float *)arg) = r->getAverageFps();
} else {
*((float *)arg) = r->getFps();
}
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment