[ios] - restore the music background playback ability #4350

Merged
merged 6 commits into from Apr 10, 2014

Projects

None yet

5 participants

@Memphiz
Owner
Memphiz commented Mar 7, 2014

This is the final Pull Request for restoring the background music playback feature on iOS (which was broken since new iossink was introduced).

It relies on the now merged PR #4292

Please wait for my go (will do some paranoia tests again)

@Memphiz Memphiz added the Gotham label Mar 7, 2014
@jmarshallnz jmarshallnz commented on the diff Mar 8, 2014
xbmc/windowing/osx/WinSystemIOS.mm
@@ -318,6 +320,28 @@
return rtn;
}
+void CWinSystemIOS::Register(IDispResource *resource)
+{
+ CSingleLock lock(m_resourceSection);
+ m_resources.push_back(resource);
+}
+
+void CWinSystemIOS::Unregister(IDispResource* resource)
+{
+ CSingleLock lock(m_resourceSection);
+ std::vector<IDispResource*>::iterator i = find(m_resources.begin(), m_resources.end(), resource);
+ if (i != m_resources.end())
+ m_resources.erase(i);
jmarshallnz
jmarshallnz Mar 8, 2014 Member

In case you haven't heard of it, std::remove() can be useful in these situations. There's a bit of a gotcha, however, in that you need to combine it with std::erase() to get rid of unneeded items at the end of the list.

Note that it's not a requirement at all to use it, but it is designed for just this case.

Owner
Memphiz commented Mar 8, 2014

Sry line commenting is broken on iPhone - That erase thingy is 1:1 c&p from winsystemosx ;)

Owner
Memphiz commented Mar 9, 2014

Ok - i tested this once more and it works on ios5, ios6 and ios7.

Sometimes i encoutered crashs in CGUITextureManager::FreeUnusedTextures when glDeleteTextures(1, (GLuint*) &m_unusedHwTextures[i]); was called.

It seems that when we are backgrounded we are supposed to completely shutdown rendering - we do so but we hold references to unused textures here which might get deleted by ios when we are backgrounded. I figured its sane to check if those are valid textures before deleting them.

@jmarshallnz is this call to glIsTexture safe on all gl implementations?

Member

I think it should be OK.

Member

glIsTexture causes a gl pipeline flush and response from GPU, so is a slow operation (definitely on Raspberry Pi, but likely on other GL implementations).
Now maybe this is rare enough not to be an issue, but it seems possible this will cause visible stutters.
Would a quirk (EGL_TEXTURES_MAY_BE_DELETED) be safer?

Owner
Memphiz commented Mar 10, 2014

As far as i remember from the stacktrace the call to deleteunusedtextures was run from ProcessSlow (so each 500ms) and only for unused textures. But i am happy to quirk it to TARGET_DARWIN_IOS?

Also @popcornmix fyi - i got that call from

https://github.com/xbmc/xbmc/blob/master/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp#L2163

So maybe it has some performance penalties there too?

Owner
Memphiz commented Mar 10, 2014

pull requests updated ...

Member

So maybe it has some performance penalties there too?

that's during cleanup so a flush does not harm.
Even if called only every 500ms it may cause stutter. Do you have a chance and check if XBMC is in background and call glIsTexture only for this case?

Contributor

This is tagged for Gotham. Where does it stand?

Owner
Memphiz commented Mar 21, 2014

Well its Fine by me - What fernetmenta suggests (didn't get an Email - just read it now) - is possible - i will add it and reping you @t-nelson

Contributor

Sounds good. Kick off jenkins once you've pushed.

Owner
Memphiz commented Mar 23, 2014

Updated the last commit as suggested (only check via glIsTexture when app is backgrounded) - also rebased to master.

jenkins build this please

Contributor

@FernetMenta One last pass please.

@Memphiz Any squashing needed/wanted before push?

Owner
Memphiz commented Mar 24, 2014

Those commits are well split imo - if you don't mind i would get them in without squashing ...

Contributor

@Memphiz yeah sure. I just wanted to make sure they were as you wanted.

Member

jenkins build this please

Contributor
t-nelson commented Apr 3, 2014

@Memphiz ping

@Memphiz Memphiz [guilib] - sanity check hw textures before deleting (on ios when back…
…grounded it seems that ios diddles with textures and might delete them away without xbmc knowing) - do the check only when ios windowing is backgrounded
8f87119
Owner
Memphiz commented Apr 3, 2014

args - that is the problem with only compiling the changed files and skipping the link test - jenkins build this please - i really wonder why i didn't get the email 6 days ago grrrr

Contributor
t-nelson commented Apr 5, 2014

@FernetMenta ping?

Contributor

Ready here?

Owner
Memphiz commented Apr 10, 2014

Yes please - this pr is lingering :D

@t-nelson t-nelson merged commit fa2681d into xbmc:master Apr 10, 2014

1 check passed

default Merged build #454 succeeded in 1 hr 4 min
Details
@t-nelson t-nelson removed the Gotham label Apr 10, 2014
@Memphiz Memphiz deleted the Memphiz:iosbgmusic branch May 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment