mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-23 00:39:51 +00:00
a2dp: send STOP event on stream stopped or aborted
This commit is contained in:
parent
a466d50862
commit
133becec45
@ -1496,13 +1496,21 @@ typedef uint8_t sm_key_t[16];
|
||||
*/
|
||||
#define A2DP_SUBEVENT_STREAM_SUSPENDED 0x06
|
||||
|
||||
/**
|
||||
* @format 121 Stream is stoped or aborted.
|
||||
* @param subevent_code
|
||||
* @param a2dp_cid
|
||||
* @param local_seid
|
||||
*/
|
||||
#define A2DP_SUBEVENT_STREAM_STOPPED 0x07
|
||||
|
||||
/**
|
||||
* @format 121 Stream is released.
|
||||
* @param subevent_code
|
||||
* @param a2dp_cid
|
||||
* @param local_seid
|
||||
*/
|
||||
#define A2DP_SUBEVENT_STREAM_RELEASED 0x07
|
||||
#define A2DP_SUBEVENT_STREAM_RELEASED 0x08
|
||||
|
||||
/**
|
||||
* @format 1211
|
||||
@ -1511,7 +1519,7 @@ typedef uint8_t sm_key_t[16];
|
||||
* @param local_seid
|
||||
* @param signal_identifier
|
||||
*/
|
||||
#define A2DP_SUBEVENT_COMMAND_ACCEPTED 0x08
|
||||
#define A2DP_SUBEVENT_COMMAND_ACCEPTED 0x09
|
||||
|
||||
/**
|
||||
* @format 1211
|
||||
@ -1520,7 +1528,7 @@ typedef uint8_t sm_key_t[16];
|
||||
* @param local_seid
|
||||
* @param signal_identifier
|
||||
*/
|
||||
#define A2DP_SUBEVENT_COMMAND_REJECTED 0x09
|
||||
#define A2DP_SUBEVENT_COMMAND_REJECTED 0x0A
|
||||
|
||||
/**
|
||||
* @format 12B Signaling channel is opened.
|
||||
@ -1528,14 +1536,14 @@ typedef uint8_t sm_key_t[16];
|
||||
* @param a2dp_cid
|
||||
* @param bd_addr
|
||||
*/
|
||||
#define A2DP_SUBEVENT_INCOMING_CONNECTION_ESTABLISHED 0x0A
|
||||
#define A2DP_SUBEVENT_INCOMING_CONNECTION_ESTABLISHED 0x0B
|
||||
|
||||
/**
|
||||
* @format 12 Signaling channel is released.
|
||||
* @param subevent_code
|
||||
* @param a2dp_cid
|
||||
*/
|
||||
#define A2DP_SUBEVENT_SIGNALING_CONNECTION_RELEASED 0x0B
|
||||
#define A2DP_SUBEVENT_SIGNALING_CONNECTION_RELEASED 0x0C
|
||||
|
||||
|
||||
/** AVRCP Subevent */
|
||||
|
@ -4880,6 +4880,25 @@ static inline uint8_t a2dp_subevent_stream_suspended_get_local_seid(const uint8_
|
||||
return event[5];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field a2dp_cid from event A2DP_SUBEVENT_STREAM_STOPPED
|
||||
* @param event packet
|
||||
* @return a2dp_cid
|
||||
* @note: btstack_type 2
|
||||
*/
|
||||
static inline uint16_t a2dp_subevent_stream_stopped_get_a2dp_cid(const uint8_t * event){
|
||||
return little_endian_read_16(event, 3);
|
||||
}
|
||||
/**
|
||||
* @brief Get field local_seid from event A2DP_SUBEVENT_STREAM_STOPPED
|
||||
* @param event packet
|
||||
* @return local_seid
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t a2dp_subevent_stream_stopped_get_local_seid(const uint8_t * event){
|
||||
return event[5];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field a2dp_cid from event A2DP_SUBEVENT_STREAM_RELEASED
|
||||
* @param event packet
|
||||
|
@ -314,7 +314,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
break;
|
||||
case AVDTP_SI_ABORT:
|
||||
case AVDTP_SI_CLOSE:
|
||||
a2dp_emit_stream_event(a2dp_sink_context.a2dp_callback, cid, A2DP_SUBEVENT_STREAM_RELEASED, loc_seid);
|
||||
a2dp_emit_stream_event(a2dp_sink_context.a2dp_callback, cid, A2DP_SUBEVENT_STREAM_STOPPED, loc_seid);
|
||||
break;
|
||||
default:
|
||||
// a2dp_emit_cmd_accepted(a2dp_sink_context.a2dp_callback, packet, size);
|
||||
|
@ -92,6 +92,7 @@ uint8_t a2dp_sink_create_stream_endpoint(avdtp_media_type_t media_type, avdtp_me
|
||||
* - A2DP_SUBEVENT_STREAM_ESTABLISHED: received when stream to a remote device is established
|
||||
* - A2DP_SUBEVENT_STREAM_STARTED: received when stream is started
|
||||
* - A2DP_SUBEVENT_STREAM_SUSPENDED: received when stream is paused
|
||||
* - A2DP_SUBEVENT_STREAM_STOPED: received when stream is aborted or stopped
|
||||
* - A2DP_SUBEVENT_STREAM_RELEASED: received when stream is released
|
||||
* - A2DP_SUBEVENT_SIGNALING_CONNECTION_RELEASED: received when signaling channel is disconnected
|
||||
*
|
||||
|
@ -350,7 +350,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
int pos = 0;
|
||||
event[pos++] = HCI_EVENT_A2DP_META;
|
||||
event[pos++] = sizeof(event) - 2;
|
||||
event[pos++] = A2DP_SUBEVENT_STREAM_RELEASED;
|
||||
event[pos++] = A2DP_SUBEVENT_STREAM_STOPPED;
|
||||
little_endian_store_16(event, pos, cid);
|
||||
pos += 2;
|
||||
log_info("send A2DP_SUBEVENT_STREAM_RELEASED to app");
|
||||
|
@ -92,6 +92,7 @@ avdtp_stream_endpoint_t * a2dp_source_create_stream_endpoint(avdtp_media_type_t
|
||||
* - A2DP_SUBEVENT_STREAM_ESTABLISHED: Received when stream to a remote device is established.
|
||||
* - A2DP_SUBEVENT_STREAM_STARTED: Received when stream is started.
|
||||
* - A2DP_SUBEVENT_STREAM_SUSPENDED: Received when stream is paused.
|
||||
* - A2DP_SUBEVENT_STREAM_STOPED: received when stream is aborted or stopped.
|
||||
* - A2DP_SUBEVENT_STREAM_RELEASED: Received when stream is released.
|
||||
* - A2DP_SUBEVENT_STREAMING_CAN_SEND_MEDIA_PACKET_NOW: Indicates that the next media packet can be sent.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user