avdtp_source.c (744ea73d2e5963352a9ff9b55fcfb5d3b3dcdb73) | avdtp_source.c (21f2491df42b3c97a35c6e6cf252a9454eafec6b) |
---|---|
1 2/* 3 * Copyright (C) 2016 BlueKitchen GmbH 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 174 unchanged lines hidden (view full) --- 183 media_packet[pos++] = (marker << 7) | payload_type; 184 big_endian_store_16(media_packet, pos, sequence_number); 185 pos += 2; 186 big_endian_store_32(media_packet, pos, timestamp); 187 pos += 4; 188 big_endian_store_32(media_packet, pos, ssrc); // only used for multicast 189} 190 | 1 2/* 3 * Copyright (C) 2016 BlueKitchen GmbH 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 174 unchanged lines hidden (view full) --- 183 media_packet[pos++] = (marker << 7) | payload_type; 184 big_endian_store_16(media_packet, pos, sequence_number); 185 pos += 2; 186 big_endian_store_32(media_packet, pos, timestamp); 187 pos += 4; 188 big_endian_store_32(media_packet, pos, ssrc); // only used for multicast 189} 190 |
191// @deprecated, use avdtp_source_stream_send_media_payload_rtp instead 192int avdtp_source_stream_send_media_payload(uint16_t avdtp_cid, uint8_t local_seid, const uint8_t * payload, uint16_t payload_size, uint8_t num_frames, uint8_t marker){ 193 UNUSED(avdtp_cid); 194 195 avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(local_seid); 196 if (!stream_endpoint) { 197 log_error("avdtp source: no stream_endpoint with seid %d", local_seid); 198 return 0; 199 } 200 201 if (stream_endpoint->l2cap_media_cid == 0){ 202 log_error("avdtp source: no media connection for seid %d", local_seid); 203 return 0; 204 } 205 206 uint32_t buffer_size = l2cap_get_remote_mtu_for_local_cid(stream_endpoint->l2cap_media_cid); 207 uint32_t packet_size = AVDTP_MEDIA_PAYLOAD_HEADER_SIZE + payload_size + 1; 208 if (packet_size > buffer_size) return ERROR_CODE_MEMORY_CAPACITY_EXCEEDED; 209 210 l2cap_reserve_packet_buffer(); 211 uint8_t * media_packet = l2cap_get_outgoing_buffer(); 212 uint32_t timestamp = btstack_run_loop_get_time_ms(); 213 avdtp_source_setup_media_header(media_packet, marker, stream_endpoint->sequence_number, timestamp); 214 media_packet[AVDTP_MEDIA_PAYLOAD_HEADER_SIZE] = num_frames; // (fragmentation << 7) | (starting_packet << 6) | (last_packet << 5) | num_frames; 215 (void)memcpy(&media_packet[AVDTP_MEDIA_PAYLOAD_HEADER_SIZE +1], payload, payload_size); 216 stream_endpoint->sequence_number++; 217 l2cap_send_prepared(stream_endpoint->l2cap_media_cid, (uint16_t) packet_size); 218 return packet_size; 219} 220 | |
221uint8_t avdtp_source_stream_send_media_payload_rtp(uint16_t avdtp_cid, uint8_t local_seid, uint8_t marker, const uint8_t * payload, uint16_t payload_size){ 222 UNUSED(avdtp_cid); 223 224 avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(local_seid); 225 if (!stream_endpoint) { 226 log_error("avdtp source: no stream_endpoint with seid %d", local_seid); 227 return 0; 228 } --- 65 unchanged lines hidden --- | 191uint8_t avdtp_source_stream_send_media_payload_rtp(uint16_t avdtp_cid, uint8_t local_seid, uint8_t marker, const uint8_t * payload, uint16_t payload_size){ 192 UNUSED(avdtp_cid); 193 194 avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(local_seid); 195 if (!stream_endpoint) { 196 log_error("avdtp source: no stream_endpoint with seid %d", local_seid); 197 return 0; 198 } --- 65 unchanged lines hidden --- |