Android-x86
Fork
捐款

  • R/O
  • HTTP
  • SSH
  • HTTPS

hardware-libaudio: 提交

hardware/libaudio


Commit MetaInfo

修訂d9cfa852a34b299be1de178ef59257cf4bcc5e14 (tree)
時間2020-04-28 14:53:41
作者Francescodario Cuzzocrea <bosconovic@gmai...>
CommiterChih-Wei Huang

Log Message

libaudio: remove panel orientation code

- makes little sense to keep this logic as the vast majority of PCs
have only one microphone. This was something Grouper specific.

Change Summary

差異

--- a/audio_hw.c
+++ b/audio_hw.c
@@ -107,7 +107,6 @@ struct audio_device {
107107 bool standby;
108108 bool mic_mute;
109109 struct audio_route *ar;
110- int orientation;
111110 bool screen_off;
112111
113112 struct stream_out *active_out;
@@ -152,13 +151,6 @@ struct stream_in {
152151 struct audio_device *dev;
153152 };
154153
155-enum {
156- ORIENTATION_LANDSCAPE,
157- ORIENTATION_PORTRAIT,
158- ORIENTATION_SQUARE,
159- ORIENTATION_UNDEFINED,
160-};
161-
162154 static uint32_t out_get_sample_rate(const struct audio_stream *stream);
163155 static size_t out_get_buffer_size(const struct audio_stream *stream);
164156 static audio_format_t out_get_format(const struct audio_stream *stream);
@@ -281,12 +273,8 @@ static void select_devices(struct audio_device *adev)
281273 audio_route_apply_path(adev->ar, "headphone");
282274 if (docked)
283275 audio_route_apply_path(adev->ar, "dock");
284- if (main_mic_on) {
285- if (adev->orientation == ORIENTATION_LANDSCAPE)
286- audio_route_apply_path(adev->ar, "main-mic-left");
287- else
288- audio_route_apply_path(adev->ar, "main-mic-top");
289- }
276+ if (main_mic_on)
277+ audio_route_apply_path(adev->ar, "main-mic");
290278
291279 update_mixer_state(adev->ar);
292280
@@ -1138,33 +1126,6 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
11381126 int ret;
11391127
11401128 parms = str_parms_create_str(kvpairs);
1141- ret = str_parms_get_str(parms, "orientation", value, sizeof(value));
1142- if (ret >= 0) {
1143- int orientation;
1144-
1145- if (strcmp(value, "landscape") == 0)
1146- orientation = ORIENTATION_LANDSCAPE;
1147- else if (strcmp(value, "portrait") == 0)
1148- orientation = ORIENTATION_PORTRAIT;
1149- else if (strcmp(value, "square") == 0)
1150- orientation = ORIENTATION_SQUARE;
1151- else
1152- orientation = ORIENTATION_UNDEFINED;
1153-
1154- pthread_mutex_lock(&adev->lock);
1155- if (orientation != adev->orientation) {
1156- adev->orientation = orientation;
1157- /*
1158- * Orientation changes can occur with the input device
1159- * closed so we must call select_devices() here to set
1160- * up the mixer. This is because select_devices() will
1161- * not be called when the input device is opened if no
1162- * other input parameter is changed.
1163- */
1164- select_devices(adev);
1165- }
1166- pthread_mutex_unlock(&adev->lock);
1167- }
11681129
11691130 ret = str_parms_get_str(parms, "screen_state", value, sizeof(value));
11701131 if (ret >= 0) {
@@ -1348,7 +1309,7 @@ static int adev_open(const hw_module_t* module, const char* name,
13481309 adev->hw_device.dump = adev_dump;
13491310
13501311 adev->ar = audio_route_init();
1351- adev->orientation = ORIENTATION_UNDEFINED;
1312+
13521313 adev->out_device = AUDIO_DEVICE_OUT_SPEAKER;
13531314 adev->in_device = AUDIO_DEVICE_IN_BUILTIN_MIC & ~AUDIO_DEVICE_BIT_IN;
13541315
Show on old repository browser