Bug 953045 - Fix a bug of bluetooth AVRCP to support media metadata updating correctly. r=echou, a=1.3+
authorJamin Liu <jaliu@mozilla.com>
Fri, 17 Jan 2014 18:15:37 +0800
changeset 175909 7ed35166821a08444c5779e0531c06089d81192e
parent 175908 8a16fb683b1bbce09ae506aac1e69b74ad538525
child 175910 f9e38adda8ee3a74ed54366a35657a8c406fa155
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersechou, 1
bugs953045
milestone28.0a2
Bug 953045 - Fix a bug of bluetooth AVRCP to support media metadata updating correctly. r=echou, a=1.3+
dom/bluetooth/bluez/linux/BluetoothDBusService.cpp
--- a/dom/bluetooth/bluez/linux/BluetoothDBusService.cpp
+++ b/dom/bluetooth/bluez/linux/BluetoothDBusService.cpp
@@ -3149,32 +3149,40 @@ BluetoothDBusService::SendMetaData(const
 
   nsCString tempTitle = NS_ConvertUTF16toUTF8(aTitle);
   nsCString tempArtist = NS_ConvertUTF16toUTF8(aArtist);
   nsCString tempAlbum = NS_ConvertUTF16toUTF8(aAlbum);
 
   nsCString tempMediaNumber = EmptyCString();
   nsCString tempTotalMediaCount = EmptyCString();
   nsCString tempDuration = EmptyCString();
+
+  // We currently don't support genre field in music player.
+  // In order to send media metadata through AVRCP, we set genre to an empty
+  // string to match the BlueZ method "UpdateMetaData" with signature "sssssss",
+  // which takes genre field as the last parameter.
+  nsCString tempGenre = EmptyCString();
+
   if (aMediaNumber >= 0) {
     tempMediaNumber.AppendInt(aMediaNumber);
   }
   if (aTotalMediaCount >= 0) {
     tempTotalMediaCount.AppendInt(aTotalMediaCount);
   }
   if (aDuration >= 0) {
     tempDuration.AppendInt(aDuration);
   }
 
   const char* title = tempTitle.get();
   const char* album = tempAlbum.get();
   const char* artist = tempArtist.get();
   const char* mediaNumber = tempMediaNumber.get();
   const char* totalMediaCount = tempTotalMediaCount.get();
   const char* duration = tempDuration.get();
+  const char* genre = tempGenre.get();
 
   nsAutoString prevTitle, prevAlbum;
   a2dp->GetTitle(prevTitle);
   a2dp->GetAlbum(prevAlbum);
 
   if (aMediaNumber != a2dp->GetMediaNumber() ||
       !aTitle.Equals(prevTitle) ||
       !aAlbum.Equals(prevAlbum)) {
@@ -3188,16 +3196,17 @@ BluetoothDBusService::SendMetaData(const
     NS_ConvertUTF16toUTF8(objectPath).get(),
     DBUS_CTL_IFACE, "UpdateMetaData",
     DBUS_TYPE_STRING, &title,
     DBUS_TYPE_STRING, &artist,
     DBUS_TYPE_STRING, &album,
     DBUS_TYPE_STRING, &mediaNumber,
     DBUS_TYPE_STRING, &totalMediaCount,
     DBUS_TYPE_STRING, &duration,
+    DBUS_TYPE_STRING, &genre,
     DBUS_TYPE_INVALID);
   NS_ENSURE_TRUE_VOID(ret);
 
   runnable.forget();
 
   a2dp->UpdateMetaData(aTitle, aArtist, aAlbum,
                        aMediaNumber, aTotalMediaCount, aDuration);
 }