diff options
Diffstat (limited to 'audio/gstavdtpsink.c')
| -rw-r--r-- | audio/gstavdtpsink.c | 19 | 
1 files changed, 15 insertions, 4 deletions
diff --git a/audio/gstavdtpsink.c b/audio/gstavdtpsink.c index bf35407c..45a53b5d 100644 --- a/audio/gstavdtpsink.c +++ b/audio/gstavdtpsink.c @@ -786,6 +786,7 @@ static gboolean gst_avdtp_sink_get_capabilities(GstAvdtpSink *self)  		return FALSE;  	} +	rsp->h.length = 0;  	io_error = gst_avdtp_sink_audioservice_expect(self,  			&rsp->h, BT_GET_CAPABILITIES);  	if (io_error != G_IO_ERROR_NONE) { @@ -931,6 +932,7 @@ static gboolean gst_avdtp_sink_stream_start(GstAvdtpSink *self)  		return FALSE;  	} +	rsp->h.length = sizeof(*rsp);  	io_error = gst_avdtp_sink_audioservice_expect(self,  			&rsp->h, BT_START_STREAM);  	if (io_error != G_IO_ERROR_NONE) { @@ -939,6 +941,7 @@ static gboolean gst_avdtp_sink_stream_start(GstAvdtpSink *self)  		return FALSE;  	} +	ind->h.length = sizeof(*ind);  	io_error = gst_avdtp_sink_audioservice_expect(self, &ind->h,  			BT_NEW_STREAM);  	if (io_error != G_IO_ERROR_NONE) { @@ -1069,6 +1072,7 @@ static gboolean gst_avdtp_sink_configure(GstAvdtpSink *self,  		return FALSE;  	} +	req->h.length += req->codec.length - sizeof(req->codec);  	io_error = gst_avdtp_sink_audioservice_send(self, &req->h);  	if (io_error != G_IO_ERROR_NONE) {  		GST_ERROR_OBJECT(self, "Error ocurred while sending " @@ -1076,6 +1080,7 @@ static gboolean gst_avdtp_sink_configure(GstAvdtpSink *self,  		return FALSE;  	} +	rsp->h.length = sizeof(*rsp);  	io_error = gst_avdtp_sink_audioservice_expect(self,  			&rsp->h, BT_SET_CONFIGURATION);  	if (io_error != G_IO_ERROR_NONE) { @@ -1226,9 +1231,12 @@ static GIOError gst_avdtp_sink_audioservice_send(  	GIOError error;  	gsize written;  	const char *type, *name; +	uint16_t length; -	error = g_io_channel_write(self->server, (const gchar*) msg, -			BT_SUGGESTED_BUFFER_SIZE, &written); +	length = msg->length ? msg->length : BT_SUGGESTED_BUFFER_SIZE; + +	error = g_io_channel_write(self->server, (const gchar*) msg, length, +								&written);  	if (error != G_IO_ERROR_NONE)  		GST_ERROR_OBJECT(self, "Error sending data to audio service:"  			" %s(%d)", strerror(errno), errno); @@ -1248,9 +1256,12 @@ static GIOError gst_avdtp_sink_audioservice_recv(  	GIOError status;  	gsize bytes_read;  	const char *type, *name; +	uint16_t length; + +	length = inmsg->length ? inmsg->length : BT_SUGGESTED_BUFFER_SIZE; -	status = g_io_channel_read(self->server, (gchar*) inmsg, -			BT_SUGGESTED_BUFFER_SIZE, &bytes_read); +	status = g_io_channel_read(self->server, (gchar*) inmsg, length, +								&bytes_read);  	if (status != G_IO_ERROR_NONE) {  		GST_ERROR_OBJECT(self, "Error receiving data from "  				"audio service");  | 
