[banshee] PlayerEngine: Fix reporting of playback errors (bgo#680679)
- From: Bertrand Lorentz <blorentz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] PlayerEngine: Fix reporting of playback errors (bgo#680679)
- Date: Fri, 27 Jul 2012 14:42:50 +0000 (UTC)
commit 1d248f2f5bffd22829dbf39d2d76b7fab09ffaa1
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date: Fri Jul 27 16:26:11 2012 +0200
PlayerEngine: Fix reporting of playback errors (bgo#680679)
As Close() clears out CurrentTrack, we need to keep a reference to it to
be able to save the playback error.
.../Banshee.GStreamer/PlayerEngine.cs | 13 +++++++------
.../Banshee.GStreamerSharp/PlayerEngine.cs | 14 ++++++++------
2 files changed, 15 insertions(+), 12 deletions(-)
---
diff --git a/src/Backends/Banshee.GStreamer/Banshee.GStreamer/PlayerEngine.cs b/src/Backends/Banshee.GStreamer/Banshee.GStreamer/PlayerEngine.cs
index 3b95e8b..278ff51 100644
--- a/src/Backends/Banshee.GStreamer/Banshee.GStreamer/PlayerEngine.cs
+++ b/src/Backends/Banshee.GStreamer/Banshee.GStreamer/PlayerEngine.cs
@@ -497,6 +497,7 @@ namespace Banshee.GStreamer
private void OnError (IntPtr player, uint domain, int code, IntPtr error, IntPtr debug)
{
+ TrackInfo failed_track = CurrentTrack;
Close (true);
string error_message = error == IntPtr.Zero
@@ -505,10 +506,10 @@ namespace Banshee.GStreamer
if (domain == GST_RESOURCE_ERROR) {
GstResourceError domain_code = (GstResourceError) code;
- if (CurrentTrack != null) {
+ if (failed_track != null) {
switch (domain_code) {
case GstResourceError.NotFound:
- CurrentTrack.SavePlaybackError (StreamPlaybackError.ResourceNotFound);
+ failed_track.SavePlaybackError (StreamPlaybackError.ResourceNotFound);
break;
default:
break;
@@ -518,10 +519,10 @@ namespace Banshee.GStreamer
Log.Error (String.Format ("GStreamer resource error: {0}", domain_code), false);
} else if (domain == GST_STREAM_ERROR) {
GstStreamError domain_code = (GstStreamError) code;
- if (CurrentTrack != null) {
+ if (failed_track != null) {
switch (domain_code) {
case GstStreamError.CodecNotFound:
- CurrentTrack.SavePlaybackError (StreamPlaybackError.CodecNotFound);
+ failed_track.SavePlaybackError (StreamPlaybackError.CodecNotFound);
break;
default:
break;
@@ -531,10 +532,10 @@ namespace Banshee.GStreamer
Log.Error (String.Format("GStreamer stream error: {0}", domain_code), false);
} else if (domain == GST_CORE_ERROR) {
GstCoreError domain_code = (GstCoreError) code;
- if (CurrentTrack != null) {
+ if (failed_track != null) {
switch (domain_code) {
case GstCoreError.MissingPlugin:
- CurrentTrack.SavePlaybackError (StreamPlaybackError.CodecNotFound);
+ failed_track.SavePlaybackError (StreamPlaybackError.CodecNotFound);
break;
default:
break;
diff --git a/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/PlayerEngine.cs b/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/PlayerEngine.cs
index 263a61a..1bb31e2 100644
--- a/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/PlayerEngine.cs
+++ b/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/PlayerEngine.cs
@@ -45,6 +45,7 @@ using Hyena;
using Hyena.Data;
using Banshee.Base;
+using Banshee.Collection;
using Banshee.Streaming;
using Banshee.MediaEngine;
using Banshee.ServiceStack;
@@ -548,16 +549,17 @@ namespace Banshee.GStreamerSharp
private void HandleError (Enum domain, string error_message, string debug)
{
+ TrackInfo failed_track = CurrentTrack;
Close (true);
error_message = error_message ?? Catalog.GetString ("Unknown Error");
if (domain is ResourceError) {
ResourceError domain_code = (ResourceError)domain;
- if (CurrentTrack != null) {
+ if (failed_track != null) {
switch (domain_code) {
case ResourceError.NotFound:
- CurrentTrack.SavePlaybackError (StreamPlaybackError.ResourceNotFound);
+ failed_track.SavePlaybackError (StreamPlaybackError.ResourceNotFound);
break;
default:
break;
@@ -566,10 +568,10 @@ namespace Banshee.GStreamerSharp
Log.Error (String.Format ("GStreamer resource error: {0}", domain_code), false);
} else if (domain is StreamError) {
StreamError domain_code = (StreamError)domain;
- if (CurrentTrack != null) {
+ if (failed_track != null) {
switch (domain_code) {
case StreamError.CodecNotFound:
- CurrentTrack.SavePlaybackError (StreamPlaybackError.CodecNotFound);
+ failed_track.SavePlaybackError (StreamPlaybackError.CodecNotFound);
break;
default:
break;
@@ -579,10 +581,10 @@ namespace Banshee.GStreamerSharp
Log.Error (String.Format ("GStreamer stream error: {0}", domain_code), false);
} else if (domain is CoreError) {
CoreError domain_code = (CoreError)domain;
- if (CurrentTrack != null) {
+ if (failed_track != null) {
switch (domain_code) {
case CoreError.MissingPlugin:
- CurrentTrack.SavePlaybackError (StreamPlaybackError.CodecNotFound);
+ failed_track.SavePlaybackError (StreamPlaybackError.CodecNotFound);
break;
default:
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]