[rhythmbox] transfer-target: set the encoding target on the batch late
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] transfer-target: set the encoding target on the batch late
- Date: Fri, 14 Sep 2012 14:38:42 +0000 (UTC)
commit 7b362a4bcf3fe9dc30b7618271f634867c1aa4bd
Author: Jonathan Matthew <jonathan d14n org>
Date: Sat Sep 15 00:36:32 2012 +1000
transfer-target: set the encoding target on the batch late
If the target source spends much time without an encoding target
set (as some MTP devices do), setting the encoding target on the
batch when it's created can result in crashes. Instead, set it
immediately before starting the transfer, when we know the
target has been set.
shell/rb-track-transfer-batch.c | 2 +-
sources/rb-transfer-target.c | 10 ++++++----
2 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/shell/rb-track-transfer-batch.c b/shell/rb-track-transfer-batch.c
index de1d717..561f79b 100644
--- a/shell/rb-track-transfer-batch.c
+++ b/shell/rb-track-transfer-batch.c
@@ -821,7 +821,7 @@ rb_track_transfer_batch_class_init (RBTrackTransferBatchClass *klass)
"encoding target",
"GstEncodingTarget",
GST_TYPE_ENCODING_TARGET,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
/**
* RBTrackTransferBatch:source:
*
diff --git a/sources/rb-transfer-target.c b/sources/rb-transfer-target.c
index dd53009..01a6ea5 100644
--- a/sources/rb-transfer-target.c
+++ b/sources/rb-transfer-target.c
@@ -393,13 +393,11 @@ rb_transfer_target_transfer (RBTransferTarget *target, GList *entries, gboolean
GList *l;
RhythmDBEntryType *our_entry_type;
RBTrackTransferBatch *batch;
- GstEncodingTarget *encoding_target;
gboolean start_batch = FALSE;
g_object_get (target,
"shell", &shell,
"entry-type", &our_entry_type,
- "encoding-target", &encoding_target,
NULL);
g_object_get (shell, "track-transfer-queue", &xferq, NULL);
g_object_unref (shell);
@@ -407,14 +405,13 @@ rb_transfer_target_transfer (RBTransferTarget *target, GList *entries, gboolean
batch = g_object_steal_data (G_OBJECT (target), "transfer-target-batch");
if (batch == NULL) {
- batch = rb_track_transfer_batch_new (encoding_target, NULL, G_OBJECT (target));
+ batch = rb_track_transfer_batch_new (NULL, NULL, G_OBJECT (target));
g_signal_connect_object (batch, "get-dest-uri", G_CALLBACK (get_dest_uri_cb), target, 0);
g_signal_connect_object (batch, "track-done", G_CALLBACK (track_done_cb), target, 0);
} else {
start_batch = TRUE;
}
- gst_encoding_target_unref (encoding_target);
for (l = entries; l != NULL; l = l->next) {
RhythmDBEntry *entry;
@@ -443,6 +440,11 @@ rb_transfer_target_transfer (RBTransferTarget *target, GList *entries, gboolean
if (defer) {
g_object_set_data_full (G_OBJECT (target), "transfer-target-batch", g_object_ref (batch), g_object_unref);
} else {
+ GstEncodingTarget *encoding_target;
+ g_object_get (target, "encoding-target", &encoding_target, NULL);
+ g_object_set (batch, "encoding-target", encoding_target, NULL);
+ gst_encoding_target_unref (encoding_target);
+
rb_track_transfer_queue_start_batch (xferq, batch);
}
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]