OSDN Git Service

android/hal-audio: Add support to close output stream
authorAndrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
Wed, 15 Jan 2014 18:03:51 +0000 (19:03 +0100)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Thu, 16 Jan 2014 14:01:40 +0000 (16:01 +0200)
android/hal-audio.c

index 75402ab..236d0c5 100644 (file)
@@ -400,6 +400,21 @@ static int ipc_open_stream_cmd(uint8_t endpoint_id,
        return result;
 }
 
+static int ipc_close_stream_cmd(uint8_t endpoint_id)
+{
+       struct audio_cmd_close_stream cmd;
+       int result;
+
+       DBG("");
+
+       cmd.id = endpoint_id;
+
+       result = audio_ipc_cmd(AUDIO_SERVICE_ID, AUDIO_OP_CLOSE_STREAM,
+                               sizeof(cmd), &cmd, NULL, NULL, NULL);
+
+       return result;
+}
+
 static int register_endpoints(void)
 {
        struct audio_endpoint *ep = &audio_endpoints[0];
@@ -697,9 +712,14 @@ static void audio_close_output_stream(struct audio_hw_device *dev,
                                        struct audio_stream_out *stream)
 {
        struct a2dp_audio_dev *a2dp_dev = (struct a2dp_audio_dev *) dev;
+       struct audio_endpoint *ep = a2dp_dev->out->ep;
 
        DBG("");
 
+       ipc_close_stream_cmd(ep->id);
+
+       /* TODO: cleanup codec */
+
        free(stream);
        a2dp_dev->out = NULL;
 }