1

I'm working on music app for WP7. It downloads music from our servers in form of little segments (each track is devided into 128k encrypted pieces). I'm using AudioPlayerAgent and AudioStreamingAgent to download, decrypt and play music.

Everything works fine, while I start application from visual studio via F5. When I start app from menu on emulator or device, everything works fine except of music is not playing. BackgroundAudioPlayer never starts. Doesn't metter if I try debug or release build, or if I try it on emulator or real device(Nokia Lumia 710 and HTC HD7 Pro).

I think that I have everything correctly setted up in AppManifest:

<Capabilities>
  <Capability Name="ID_CAP_GAMERSERVICES" />
  <Capability Name="ID_CAP_IDENTITY_DEVICE" />
  <Capability Name="ID_CAP_IDENTITY_USER" />
  <Capability Name="ID_CAP_LOCATION" />
  <Capability Name="ID_CAP_MEDIALIB" />
  <Capability Name="ID_CAP_MICROPHONE" />
  <Capability Name="ID_CAP_NETWORKING" />
  <Capability Name="ID_CAP_PHONEDIALER" />
  <Capability Name="ID_CAP_PUSH_NOTIFICATION" />
  <Capability Name="ID_CAP_SENSORS" />
  <Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />
</Capabilities>
<Tasks>     
  <DefaultTask Name="_default" NavigationPage="Panorama.xaml" />
  <ExtendedTask Name="BackgroundTask">
    <BackgroundServiceAgent Specifier="AudioPlayerAgent" Name="AudioPlaybackAgent1" Source="AudioPlaybackAgent1" Type="AudioPlaybackAgent1.AudioPlayer" />
    <BackgroundServiceAgent Specifier="AudioStreamingAgent" Name="AudioStreamAgent1" Source="AudioStreamAgent1" Type="AudioStreamAgent1.AudioTrackStreamer" />
  </ExtendedTask>
</Tasks>

After some research I found that I can enable hidden console for emulator to see debug log. I tried to track what happens when I start app from emulator menu. In point where BackgroundAudioPlayer should start playing track following message appers:

PID:0E8500C6 TID:0EEE006A Sentinels are Disabled for all processes.PID:0E8500C6 TID:0EC500DE Exception 'Raised Exception' (0xc0008005): Thread-Id=0ec500de(pth=c0654930), Proc-Id=0e8500c6(pprc=c05f3160) 'HeadlessHost.exe', VM-active=0e8500c6(pprc=c05f3160) 'HeadlessHost.exe'
PID:0E8500C6 TID:0EC500DE PC=42a629f7(mscoree3_7.dll+0x000529f7) RA=42ac3ae5(mscoree3_7.dll+0x000b3ae5) SP=0634f6b8, BVA=00000000

I also tried to test app in MarketplaceTestKit if any unsupported Api is causing it, but app passed all test fine.

So my question is: does anybody know, while app is playing only when attached to debugger?

Thank You,

Jan.

1
  • I think that I found solution. Here: goo.gl/baiCN is written, that: - Both types of background audio agents are hosted in the same process and share a maximum memory limit of 15 MB. - When running under the debugger, the memory and run-time constraints are ignored by the Windows Phone operating system. In my app I used cyclic buffer to store decrypted and decoded PCM data to play, but this buffer had over 10 MB. So when I made this buffer smaller, app began to play audio when debugger was not attached. Hope that this will help someone, Ragards, Jan...
    – jano
    Mar 15, 2012 at 9:36

1 Answer 1

1

You should only have one type of background audio agent in your app.
Based on your description of how you're getting the tracks, it seems that using the streaming agent will be more appropriate.
If you're playing each segment directly (treating it as a separate track) and there isn't an issue with gaps as you switch between segments (tracks) then you could use the playback agent.

Having multiple background audio agents specified can cause your app to crash. Note. You'll have to edit the WMAppManifest file directly to remove the one you don't want.

1
  • Hi, thanks for reply. I've followed Background Audio Streamer Sample from MSDN code samples and goo.gl/bX4nm. AudioStreamer downloads and decodes segments and streams decoded PCM data for BackgroundAudioPlayer. I checked again Microsofts's Background Audio Streamer Sample and they have also these two BackgroundServiceAgent tasks in manifest. As I mentioned in my comment to my question, problem was buffer of decoded PCM data in streamer which was too large. Background audio agents (streamer+player) could not exceed 15MB of memory.
    – jano
    Mar 15, 2012 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.