Lines Matching full:stream

35 static inline struct btp_bap_unicast_stream *stream_bap_to_unicast(struct bt_bap_stream *stream)  in stream_bap_to_unicast()  argument
37 return CONTAINER_OF(CONTAINER_OF(CONTAINER_OF(stream, struct bt_cap_stream, bap_stream), in stream_bap_to_unicast()
42 static inline struct bt_bap_stream *stream_unicast_to_bap(struct btp_bap_unicast_stream *stream) in stream_unicast_to_bap() argument
44 return &stream->audio_stream.cap_stream.bap_stream; in stream_unicast_to_bap()
111 void btp_bap_unicast_stream_free(struct btp_bap_unicast_stream *stream) in btp_bap_unicast_stream_free() argument
113 (void)memset(stream, 0, sizeof(*stream)); in btp_bap_unicast_stream_free()
120 struct bt_bap_stream *stream = stream_unicast_to_bap(&conn->streams[i]); in btp_bap_unicast_stream_find() local
123 if (stream->ep == NULL) { in btp_bap_unicast_stream_find()
127 (void)bt_bap_ep_get_info(stream->ep, &info); in btp_bap_unicast_stream_find()
326 const struct bt_audio_codec_cfg *codec_cfg, struct bt_bap_stream **stream, in lc3_config() argument
351 LOG_DBG("No free stream available"); in lc3_config()
360 *stream = stream_unicast_to_bap(u_stream); in lc3_config()
361 LOG_DBG("ASE Codec Config stream %p", *stream); in lc3_config()
374 static int lc3_reconfig(struct bt_bap_stream *stream, enum bt_audio_dir dir, in lc3_reconfig() argument
378 LOG_DBG("ASE Codec Reconfig: stream %p", stream); in lc3_reconfig()
385 static int lc3_qos(struct bt_bap_stream *stream, const struct bt_bap_qos_cfg *qos, in lc3_qos() argument
388 LOG_DBG("QoS: stream %p qos %p", stream, qos); in lc3_qos()
428 static int lc3_enable(struct bt_bap_stream *stream, const uint8_t meta[], size_t meta_len, in lc3_enable() argument
434 LOG_DBG("Metadata: stream %p meta_len %zu", stream, meta_len); in lc3_enable()
438 (void)bt_bap_ep_get_info(stream->ep, &info); in lc3_enable()
439 btp_send_ascs_operation_completed_ev(stream->conn, info.id, in lc3_enable()
446 static int lc3_start(struct bt_bap_stream *stream, struct bt_bap_ascs_rsp *rsp) in lc3_start() argument
448 LOG_DBG("Start: stream %p", stream); in lc3_start()
453 static int lc3_metadata(struct bt_bap_stream *stream, const uint8_t meta[], size_t meta_len, in lc3_metadata() argument
459 LOG_DBG("Metadata: stream %p meta_count %zu", stream, meta_len); in lc3_metadata()
463 (void)bt_bap_ep_get_info(stream->ep, &info); in lc3_metadata()
464 btp_send_ascs_operation_completed_ev(stream->conn, info.id, in lc3_metadata()
471 static int lc3_disable(struct bt_bap_stream *stream, struct bt_bap_ascs_rsp *rsp) in lc3_disable() argument
473 LOG_DBG("Disable: stream %p", stream); in lc3_disable()
478 static int lc3_stop(struct bt_bap_stream *stream, struct bt_bap_ascs_rsp *rsp) in lc3_stop() argument
480 LOG_DBG("Stop: stream %p", stream); in lc3_stop()
485 static int lc3_release(struct bt_bap_stream *stream, struct bt_bap_ascs_rsp *rsp) in lc3_release() argument
487 LOG_DBG("Release: stream %p", stream); in lc3_release()
504 static void stream_configured(struct bt_bap_stream *stream, const struct bt_bap_qos_cfg_pref *pref) in stream_configured() argument
508 struct btp_bap_unicast_stream *u_stream = stream_bap_to_unicast(stream); in stream_configured()
510 (void)bt_bap_ep_get_info(stream->ep, &info); in stream_configured()
511 LOG_DBG("Configured stream %p, ep %u, dir %u", stream, info.id, info.dir); in stream_configured()
513 u_stream->conn_id = bt_conn_index(stream->conn); in stream_configured()
517 btp_send_ascs_operation_completed_ev(stream->conn, u_stream->ase_id, in stream_configured()
521 static void stream_qos_set(struct bt_bap_stream *stream) in stream_qos_set() argument
523 struct btp_bap_unicast_stream *u_stream = stream_bap_to_unicast(stream); in stream_qos_set()
525 LOG_DBG("QoS set stream %p", stream); in stream_qos_set()
526 btp_send_ascs_operation_completed_ev(stream->conn, u_stream->ase_id, in stream_qos_set()
530 static void stream_enabled(struct bt_bap_stream *stream) in stream_enabled() argument
532 struct btp_bap_unicast_stream *u_stream = stream_bap_to_unicast(stream); in stream_enabled()
537 LOG_DBG("Enabled stream %p", stream); in stream_enabled()
539 (void)bt_bap_ep_get_info(stream->ep, &info); in stream_enabled()
540 (void)bt_conn_get_info(stream->conn, &conn_info); in stream_enabled()
543 err = bt_bap_stream_start(stream); in stream_enabled()
545 LOG_DBG("Failed to start stream %p", stream); in stream_enabled()
546 btp_send_ascs_operation_completed_ev(stream->conn, u_stream->ase_id, in stream_enabled()
554 btp_send_ascs_operation_completed_ev(stream->conn, u_stream->ase_id, in stream_enabled()
558 static void stream_metadata_updated(struct bt_bap_stream *stream) in stream_metadata_updated() argument
560 struct btp_bap_unicast_stream *u_stream = stream_bap_to_unicast(stream); in stream_metadata_updated()
562 LOG_DBG("Metadata updated stream %p", stream); in stream_metadata_updated()
563 btp_send_ascs_operation_completed_ev(stream->conn, u_stream->ase_id, in stream_metadata_updated()
567 static void stream_disabled(struct bt_bap_stream *stream) in stream_disabled() argument
569 struct btp_bap_unicast_stream *u_stream = stream_bap_to_unicast(stream); in stream_disabled()
571 LOG_DBG("Disabled stream %p", stream); in stream_disabled()
573 btp_send_ascs_operation_completed_ev(stream->conn, u_stream->ase_id, in stream_disabled()
577 static void stream_released(struct bt_bap_stream *stream) in stream_released() argument
582 struct btp_bap_unicast_stream *u_stream = stream_bap_to_unicast(stream); in stream_released()
584 LOG_DBG("Released stream %p", stream); in stream_released()
588 if (stream->ep != NULL) { in stream_released()
589 (void)bt_bap_ep_get_info(stream->ep, &info); in stream_released()
605 /* The unicast group will be deleted only at release of the last stream */ in stream_released()
620 static void stream_started(struct bt_bap_stream *stream) in stream_started() argument
622 struct btp_bap_unicast_stream *u_stream = stream_bap_to_unicast(stream); in stream_started()
627 LOG_DBG("Started stream %p", stream); in stream_started()
635 LOG_ERR("Failed to register stream: %d", err); in stream_started()
639 (void)bt_bap_ep_get_info(stream->ep, &info); in stream_started()
640 btp_send_ascs_ase_state_changed_ev(stream->conn, u_stream->ase_id, info.state); in stream_started()
643 static void stream_connected(struct bt_bap_stream *stream) in stream_connected() argument
649 LOG_DBG("Connected stream %p", stream); in stream_connected()
651 (void)bt_bap_ep_get_info(stream->ep, &ep_info); in stream_connected()
652 (void)bt_conn_get_info(stream->conn, &conn_info); in stream_connected()
656 err = bt_bap_stream_start(stream); in stream_connected()
658 LOG_ERR("Failed to start stream %p", stream); in stream_connected()
663 static void stream_stopped(struct bt_bap_stream *stream, uint8_t reason) in stream_stopped() argument
665 struct btp_bap_unicast_stream *u_stream = stream_bap_to_unicast(stream); in stream_stopped()
667 LOG_DBG("Stopped stream %p with reason 0x%02X", stream, reason); in stream_stopped()
674 LOG_ERR("Failed to unregister stream: %d", err); in stream_stopped()
678 btp_send_ascs_operation_completed_ev(stream->conn, u_stream->ase_id, in stream_stopped()
690 LOG_DBG("Stream received, ep %d, dir %d, len %d", ep->status.id, ep->dir, in send_stream_received_ev()
705 static void stream_recv(struct bt_bap_stream *stream, in stream_recv() argument
709 struct btp_bap_unicast_stream *u_stream = stream_bap_to_unicast(stream); in stream_recv()
715 LOG_DBG("Incoming audio on stream %p len %u flags 0x%02X seq_num %u and ts %u", in stream_recv()
716 stream, buf->len, info->flags, info->seq_num, info->ts); in stream_recv()
720 send_stream_received_ev(stream->conn, stream->ep, buf->len, buf->data); in stream_recv()
743 struct btp_bap_unicast_stream *stream = &conn->streams[i]; in btp_bap_unicast_stream_alloc() local
745 if (stream->in_use == false) { in btp_bap_unicast_stream_alloc()
746 bt_bap_stream_cb_register(stream_unicast_to_bap(stream), &stream_ops); in btp_bap_unicast_stream_alloc()
747 stream->in_use = true; in btp_bap_unicast_stream_alloc()
749 return stream; in btp_bap_unicast_stream_alloc()
770 static void config_cb(struct bt_bap_stream *stream, enum bt_bap_ascs_rsp_code rsp_code, in config_cb() argument
773 LOG_DBG("stream %p config operation rsp_code %u reason %u", stream, rsp_code, reason); in config_cb()
776 static void qos_cb(struct bt_bap_stream *stream, enum bt_bap_ascs_rsp_code rsp_code, in qos_cb() argument
779 LOG_DBG("stream %p qos operation rsp_code %u reason %u", stream, rsp_code, reason); in qos_cb()
782 static void enable_cb(struct bt_bap_stream *stream, enum bt_bap_ascs_rsp_code rsp_code, in enable_cb() argument
785 LOG_DBG("stream %p enable operation rsp_code %u reason %u", stream, rsp_code, reason); in enable_cb()
788 static void start_cb(struct bt_bap_stream *stream, enum bt_bap_ascs_rsp_code rsp_code, in start_cb() argument
791 struct btp_bap_unicast_stream *u_stream = stream_bap_to_unicast(stream); in start_cb()
795 LOG_DBG("stream %p start operation rsp_code %u reason %u", stream, rsp_code, reason); in start_cb()
798 btp_send_ascs_operation_completed_ev(stream->conn, u_stream->ase_id, in start_cb()
802 static void stop_cb(struct bt_bap_stream *stream, enum bt_bap_ascs_rsp_code rsp_code, in stop_cb() argument
805 LOG_DBG("stream %p stop operation rsp_code %u reason %u", stream, rsp_code, reason); in stop_cb()
808 static void disable_cb(struct bt_bap_stream *stream, enum bt_bap_ascs_rsp_code rsp_code, in disable_cb() argument
811 LOG_DBG("stream %p disable operation rsp_code %u reason %u", stream, rsp_code, reason); in disable_cb()
814 static void metadata_cb(struct bt_bap_stream *stream, enum bt_bap_ascs_rsp_code rsp_code, in metadata_cb() argument
817 LOG_DBG("stream %p metadata operation rsp_code %u reason %u", stream, rsp_code, reason); in metadata_cb()
820 static void release_cb(struct bt_bap_stream *stream, enum bt_bap_ascs_rsp_code rsp_code, in release_cb() argument
823 LOG_DBG("stream %p release operation rsp_code %u reason %u", stream, rsp_code, reason); in release_cb()
966 static int server_stream_config(struct bt_conn *conn, struct bt_bap_stream *stream, in server_stream_config() argument
973 err = bt_bap_unicast_server_config_ase(conn, stream, codec_cfg, qos); in server_stream_config()
979 (void)bt_bap_ep_get_info(stream->ep, &info); in server_stream_config()
982 LOG_DBG("ASE Codec Config stream %p", stream); in server_stream_config()
990 struct btp_bap_unicast_stream *stream; in client_add_ase_to_cis() local
997 stream = btp_bap_unicast_stream_find(u_conn, ase_id); in client_add_ase_to_cis()
998 if (stream == NULL) { in client_add_ase_to_cis()
1004 stream->cig_id = cig_id; in client_add_ase_to_cis()
1005 stream->cis_id = cis_id; in client_add_ase_to_cis()
1020 struct bt_bap_stream *stream = stream_unicast_to_bap(u_stream); in client_unicast_group_param_set() local
1031 stream_params->stream = stream; in client_unicast_group_param_set()
1162 struct btp_bap_unicast_stream *stream; in client_configure_codec() local
1164 stream = btp_bap_unicast_stream_find(u_conn, ase_id); in client_configure_codec()
1165 if (stream == NULL) { in client_configure_codec()
1166 /* Configure a new stream */ in client_configure_codec()
1167 stream = btp_bap_unicast_stream_alloc(u_conn); in client_configure_codec()
1168 if (stream == NULL) { in client_configure_codec()
1183 memcpy(&stream->codec_cfg, codec_cfg, sizeof(*codec_cfg)); in client_configure_codec()
1184 err = bt_bap_stream_config(conn, stream_unicast_to_bap(stream), ep, in client_configure_codec()
1185 &stream->codec_cfg); in client_configure_codec()
1187 /* Reconfigure a stream */ in client_configure_codec()
1188 memcpy(&stream->codec_cfg, codec_cfg, sizeof(*codec_cfg)); in client_configure_codec()
1189 err = bt_bap_stream_reconfig(stream_unicast_to_bap(stream), in client_configure_codec()
1190 &stream->codec_cfg); in client_configure_codec()
1199 struct btp_bap_unicast_stream *stream; in server_configure_codec() local
1202 stream = btp_bap_unicast_stream_find(u_conn, ase_id); in server_configure_codec()
1203 if (stream == NULL) { in server_configure_codec()
1210 stream = btp_bap_unicast_stream_find(u_conn, i); in server_configure_codec()
1211 if (stream != NULL) { in server_configure_codec()
1215 /* Configure a new stream */ in server_configure_codec()
1216 stream = btp_bap_unicast_stream_alloc(u_conn); in server_configure_codec()
1217 if (stream == NULL) { in server_configure_codec()
1223 memcpy(&stream->codec_cfg, codec_cfg, sizeof(*codec_cfg)); in server_configure_codec()
1224 err = server_stream_config(conn, stream_unicast_to_bap(stream), in server_configure_codec()
1225 &stream->codec_cfg, &qos_pref); in server_configure_codec()
1228 /* Reconfigure a stream */ in server_configure_codec()
1229 memcpy(&stream->codec_cfg, codec_cfg, sizeof(*codec_cfg)); in server_configure_codec()
1230 err = bt_bap_stream_reconfig(stream_unicast_to_bap(stream), &stream->codec_cfg); in server_configure_codec()
1277 LOG_DBG("Failed to configure stream (err %d)", err); in btp_ascs_configure_codec()
1358 struct btp_bap_unicast_stream *stream; in btp_ascs_enable() local
1372 stream = btp_bap_unicast_stream_find(u_conn, cp->ase_id); in btp_ascs_enable()
1373 if (stream == NULL) { in btp_ascs_enable()
1377 LOG_DBG("Enabling stream"); in btp_ascs_enable()
1378 err = bt_bap_stream_enable(stream_unicast_to_bap(stream), NULL, 0); in btp_ascs_enable()
1380 LOG_DBG("Could not enable stream: %d", err); in btp_ascs_enable()
1392 struct btp_bap_unicast_stream *stream; in btp_ascs_disable() local
1406 stream = btp_bap_unicast_stream_find(u_conn, cp->ase_id); in btp_ascs_disable()
1407 if (stream == NULL) { in btp_ascs_disable()
1411 LOG_DBG("Disabling stream"); in btp_ascs_disable()
1413 err = bt_bap_stream_disable(stream_unicast_to_bap(stream)); in btp_ascs_disable()
1415 LOG_DBG("Could not disable stream: %d", err); in btp_ascs_disable()
1428 struct btp_bap_unicast_stream *stream; in btp_ascs_receiver_start_ready() local
1444 stream = btp_bap_unicast_stream_find(u_conn, cp->ase_id); in btp_ascs_receiver_start_ready()
1445 if (stream == NULL) { in btp_ascs_receiver_start_ready()
1449 bap_stream = stream_unicast_to_bap(stream); in btp_ascs_receiver_start_ready()
1456 LOG_DBG("Starting stream %p, ep %u, dir %u", bap_stream, cp->ase_id, info.dir); in btp_ascs_receiver_start_ready()
1468 LOG_DBG("Could not connect stream: %d", err); in btp_ascs_receiver_start_ready()
1484 struct btp_bap_unicast_stream *stream; in btp_ascs_receiver_stop_ready() local
1498 stream = btp_bap_unicast_stream_find(u_conn, cp->ase_id); in btp_ascs_receiver_stop_ready()
1499 if (stream == NULL) { in btp_ascs_receiver_stop_ready()
1503 LOG_DBG("Stopping stream"); in btp_ascs_receiver_stop_ready()
1504 err = bt_bap_stream_stop(stream_unicast_to_bap(stream)); in btp_ascs_receiver_stop_ready()
1506 LOG_DBG("Could not stop stream: %d", err); in btp_ascs_receiver_stop_ready()
1518 struct btp_bap_unicast_stream *stream; in btp_ascs_release() local
1532 stream = btp_bap_unicast_stream_find(u_conn, cp->ase_id); in btp_ascs_release()
1533 if (stream == NULL) { in btp_ascs_release()
1537 LOG_DBG("Releasing stream"); in btp_ascs_release()
1538 err = bt_bap_stream_release(stream_unicast_to_bap(stream)); in btp_ascs_release()
1540 LOG_DBG("Unable to release stream, err %d", err); in btp_ascs_release()
1556 struct btp_bap_unicast_stream *stream; in btp_ascs_update_metadata() local
1571 stream = btp_bap_unicast_stream_find(u_conn, cp->ase_id); in btp_ascs_update_metadata()
1572 if (stream == NULL) { in btp_ascs_update_metadata()
1576 LOG_DBG("Updating stream metadata"); in btp_ascs_update_metadata()
1577 err = bt_bap_stream_metadata(stream_unicast_to_bap(stream), meta, ARRAY_SIZE(meta)); in btp_ascs_update_metadata()
1579 LOG_DBG("Failed to update stream metadata, err %d", err); in btp_ascs_update_metadata()