avdtp: return ERROR_CODE_COMMAND_DISALLOWED, if start streaming is called twice in a row, return the same status for stop/suspend/abort instead of ERROR_CODE_SUCCESS

This commit is contained in:
Milanka Ringwald 2020-05-05 11:20:01 +02:00 committed by Matthias Ringwald
parent b7f7a8fb81
commit 440d8d82d6

View File

@ -823,6 +823,10 @@ uint8_t avdtp_start_stream(uint16_t avdtp_cid, uint8_t local_seid, avdtp_context
return AVDTP_SEID_DOES_NOT_EXIST; return AVDTP_SEID_DOES_NOT_EXIST;
} }
if (!is_avdtp_remote_seid_registered(stream_endpoint) || stream_endpoint->start_stream == 1){
return ERROR_CODE_COMMAND_DISALLOWED;
}
stream_endpoint->start_stream = 1; stream_endpoint->start_stream = 1;
connection->initiator_local_seid = local_seid; connection->initiator_local_seid = local_seid;
connection->initiator_remote_seid = stream_endpoint->remote_sep.seid; connection->initiator_remote_seid = stream_endpoint->remote_sep.seid;
@ -849,7 +853,7 @@ uint8_t avdtp_stop_stream(uint16_t avdtp_cid, uint8_t local_seid, avdtp_context_
} }
if (!is_avdtp_remote_seid_registered(stream_endpoint) || stream_endpoint->stop_stream){ if (!is_avdtp_remote_seid_registered(stream_endpoint) || stream_endpoint->stop_stream){
return ERROR_CODE_SUCCESS; return ERROR_CODE_COMMAND_DISALLOWED;
} }
stream_endpoint->stop_stream = 1; stream_endpoint->stop_stream = 1;
@ -878,7 +882,7 @@ uint8_t avdtp_abort_stream(uint16_t avdtp_cid, uint8_t local_seid, avdtp_context
} }
if (!is_avdtp_remote_seid_registered(stream_endpoint) || stream_endpoint->abort_stream){ if (!is_avdtp_remote_seid_registered(stream_endpoint) || stream_endpoint->abort_stream){
return ERROR_CODE_SUCCESS; return ERROR_CODE_COMMAND_DISALLOWED;
} }
stream_endpoint->abort_stream = 1; stream_endpoint->abort_stream = 1;
@ -906,7 +910,7 @@ uint8_t avdtp_suspend_stream(uint16_t avdtp_cid, uint8_t local_seid, avdtp_conte
} }
if (!is_avdtp_remote_seid_registered(stream_endpoint) || stream_endpoint->suspend_stream){ if (!is_avdtp_remote_seid_registered(stream_endpoint) || stream_endpoint->suspend_stream){
return ERROR_CODE_SUCCESS; return ERROR_CODE_COMMAND_DISALLOWED;
} }
stream_endpoint->suspend_stream = 1; stream_endpoint->suspend_stream = 1;