Skip to content

Commit 6e93a4a

Browse files
committed
ao_audiotrack: set content type if --audio-set-media-role is enabled
1 parent b11c95d commit 6e93a4a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

audio/out/ao_audiotrack.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,10 +304,12 @@ static int AudioTrack_New(struct ao *ao)
304304
MP_JNI_EXCEPTION_LOG(ao);
305305
tmp = MP_JNI_CALL_OBJECT(attr_builder, AudioAttributesBuilder.setUsage, AudioAttributes.USAGE_MEDIA);
306306
MP_JNI_LOCAL_FREEP(&tmp);
307-
jint content_type = (ao->init_flags & AO_INIT_MEDIA_ROLE_MUSIC) ?
308-
AudioAttributes.CONTENT_TYPE_MUSIC : AudioAttributes.CONTENT_TYPE_MOVIE;
309-
tmp = MP_JNI_CALL_OBJECT(attr_builder, AudioAttributesBuilder.setContentType, content_type);
310-
MP_JNI_LOCAL_FREEP(&tmp);
307+
if (ao->set_media_role) {
308+
jint content_type = (ao->init_flags & AO_INIT_MEDIA_ROLE_MUSIC) ?
309+
AudioAttributes.CONTENT_TYPE_MUSIC : AudioAttributes.CONTENT_TYPE_MOVIE;
310+
tmp = MP_JNI_CALL_OBJECT(attr_builder, AudioAttributesBuilder.setContentType, content_type);
311+
MP_JNI_LOCAL_FREEP(&tmp);
312+
}
311313
jobject attr = MP_JNI_CALL_OBJECT(attr_builder, AudioAttributesBuilder.build);
312314
MP_JNI_LOCAL_FREEP(&attr_builder);
313315

0 commit comments

Comments
 (0)