[MediaController] Remove useless method call and fix the bug of foreach method (...
authorhsgwon <haesu.gwon@samsung.com>
Mon, 15 Apr 2019 06:12:33 +0000 (15:12 +0900)
committerGitHub <noreply@github.com>
Mon, 15 Apr 2019 06:12:33 +0000 (15:12 +0900)
src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerPlaylist.cs
src/Tizen.Multimedia.Remoting/MediaController/MediaControlPlaylist.cs
src/Tizen.Multimedia.Remoting/MediaController/MediaController.cs

index c20eb6f072918ef6fbc390c32e5d3fbfcd26df69..0b05dee9b3a07310a76087ee3f4f6fd1d52940f2 100644 (file)
@@ -31,7 +31,7 @@ internal static partial class Interop
             IntPtr handle, IntPtr userData);
 
         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-        internal delegate void PlaylistCallback(IntPtr handle, IntPtr userData);
+        internal delegate bool PlaylistCallback(IntPtr handle, IntPtr userData);
 
         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         internal delegate bool PlaylistItemCallback(string index, IntPtr handle, IntPtr userData);
index d5cecdc8ca75a1c498bf29eb2625dba427791c89..e636e974bff685380993b230885fc4e5d9049efc 100644 (file)
@@ -190,8 +190,6 @@ namespace Tizen.Multimedia.Remoting
             {
                 AddMetadata(data.Key, data.Value);
             }
-
-            MediaControlServer.SavePlaylist(Handle);
         }
 
         /// <summary>
index 3ca8b4749c1933bd7192d1e4e9f3870e73e3f388..10b46822bc9ea2a25c819146b0a10719968fd085 100644 (file)
@@ -189,13 +189,29 @@ namespace Tizen.Multimedia.Remoting
 
             var playlists = new List<MediaControlPlaylist>();
 
+            Exception caught = null;
+
             NativePlaylist.PlaylistCallback playlistCallback = (handle, _) =>
             {
-                playlists.Add(new MediaControlPlaylist(handle));
+                try
+                {
+                    playlists.Add(new MediaControlPlaylist(handle));
+                    return true;
+                }
+                catch (Exception e)
+                {
+                    caught = e;
+                    return false;
+                }
             };
             NativePlaylist.ForeachServerPlaylist(Manager.Handle, ServerAppId, playlistCallback, IntPtr.Zero)
                 .ThrowIfError("Failed to get playlist.");
 
+            if (caught != null)
+            {
+                throw caught;
+            }
+
             return playlists.AsReadOnly();
         }