This topic describes only module-specific error codes. For details about universal error codes, see Universal Error Codes.
Error Message
Invalid parameter.
Description
A parameter passed in the API is invalid.
Possible Causes
The parameter is invalid. For example, the parameter value is not within the range supported.
Solution
Pass the correct parameters in the API.
Error Message
Memory allocation failed.
Description
When the API is called, the memory fails to be allocated or a null pointer occurs.
Possible Causes
Solution
Error Message
Operation not permitted at current state.
Description
The current state of the object does not support this operation.
Possible Causes
The operation is not supported in the current state of the object, for example, attempting to play data without starting the stream.
Solution
Error Message
Unsupported option.
Description
The parameter value is not supported.
Possible Causes
The value of the input parameter is not within the range supported.
Solution
Error Message
Timeout.
Description
The processing times out.
Possible Causes
Solution
Error Message
Too many audio streams.
Description
The number of audio streams reaches the upper limit.
Possible Causes
Excess audio streams are not released in a timely manner.
Solution
Error Message
System error.
Description
The audio API fails to be processed due to a system processing exception. Different APIs return this error code for different reasons. You need to troubleshoot based on the failed API and system logs.
Possible Causes
Solution
The following are common problem cases when the AudioCapturer service returns error code 6800301.
When createAudioCapturer returns error code 6800301, perform troubleshooting based on the system logs in the following scenarios.
Basis for Judgment
The application process log displays Invalid sourceType.
<Application process name>: [CheckAndReportErrorEvent]Invalid sourceType -1!
The preceding log format is supported since API version 20.
Possible Causes
AudioCapturerInfo.source is not within the audio source types supported by the API.
Solution
Check the value of source based on SourceType.
Basis for Judgment
Any of the following messages appears in the application process log:
<Application process name>: [CheckCapturerAudioStreamInfo]Unsupported audio capturer parameter <Application process name>: [IsRecordChannelRelatedInfoValid]AudioStream: Invalid source channel 0 <Application process name>: [IsRecordChannelRelatedInfoValid]AudioStream: Invalid source channel layout <Application process name>: [IsRecordChannelRelatedInfoValid]AudioStream: not matched source channel and channel layout
The preceding log format is supported since API version 23.
Possible Causes
Solution
When createAudioCapturer returns error code 6800301, troubleshoot the following scenarios in sequence based on the system logs.
Basis for Judgment
The creation of an AudioCapturer using a Mic audio source (that is, SourceType is SOURCE_TYPE_MIC, SOURCE_TYPE_VOICE_RECOGNITION, SOURCE_TYPE_VOICE_COMMUNICATION, SOURCE_TYPE_VOICE_MESSAGE, or SOURCE_TYPE_LIVE) fails, and the system log indicates that the microphone is not authorized. For the permission requirements of each audio source, see Using AudioCapturer for Audio Recording.
The system audio service process may output one or more of the following logs:
audio_server: [VerifyClientPermission]Permission denied [...], [ohos.permission.MICROPHONE] audio_server: [CheckRecorderPermission]Check record permission failed: No permission. audio_server: [CreateAudioProcessInner]Create audio process failed, no permission
The CheckRecorderPermission and CreateAudioProcessInner logs are supported since API version 11; the VerifyClientPermission log is supported since API version 12.
Possible Causes
Solution
If the AudioCapturer is created successfully but calling start returns error code 6800301, troubleshoot the issue based on the system logs in the following scenarios.
Basis for Judgment
The system log indicates that the current state does not support starting.
The typical log of the application process is as follows:
<Application process name>: [CheckStateAndReportErrorEvent]Start failed. Illegal state 2. <Application process name>: [CheckStateAndReportErrorEvent]Start failed. Illegal state 4.
The preceding log format is supported since API version 18.
When the state value in the log is 2, it indicates that the AudioCapturer is in the STATE_RUNNING state, which is usually caused by calling start() repeatedly. When the state value is 4, it indicates that the AudioCapturer is in the STATE_RELEASED state, which is usually caused by calling start() again after the instance is released.
Possible Causes
The application may have repeated starts, calls after release, incomplete asynchronous state transitions, and so on.
Solution
Basis for Judgment
The log indicates a failure to activate the audio focus.
The typical log of the application process is as follows:
<Application process name>: [Start]ActivateAudioInterrupt Failed
The preceding log format is supported since API version 10.
Possible Causes
Other audio services such as recording and calls exist on the device at the same time, and the startup of the current stream is blocked by the focus policy.
Solution
Refer to Recording Concurrency Policy to check whether the current recording scenario allows concurrency with other audio services, and adjust the service startup timing or the recording stream type based on the concurrency policy.
Basis for Judgment
If, after troubleshooting based on the cases of audio stream type exception, microphone not authorized, AudioCapturer state exception, and audio focus activation failure under error code 6800301 system processing exception, the application process still reports one or more of the following logs, a system-side exception may have occurred:
<Application process name>: [StartAudioStream]Start call server failed: ... <Application process name>: [StartImpl]Start audio stream failed
The StartAudioStream log is supported since API version 11; the StartImpl log is supported since API version 12.
Possible Causes
A system exception occurs in the underlying recording stream, audio service, or input device during the startup phase.
Solution
Basis for Judgment
Starting from API version 26.0.0, calling activateAudioSession, deactivateAudioSession, or clearSelectedMediaInputDevice returns error code 6800301. When the corresponding API is called, the error message captured by the application is as follows:
Possible Causes
The system service is abnormal and unresponsive.
Solution
Try again or submit a ticket.