[AVURLAsset isPlayableExtendedMIMEType:] has internal implementation bug with codecs such as ".mp3"

Originator:sajidanwar94
Number:rdar://22000718 Date Originated:26-Jul-2015 00:08 AM
Status:Open Resolved:
Product:OS X SDK Product Version:Xcode version 6.4 (6E35b) --- OS X Yosemite version 10.10.1
Classification:Other Bug Reproducible:Always
 
Summary:
Attempting to check the extended MIME type 'audio/mpeg; codecs=".mp3"' returns false, despite the ".mp3" codec being listed in the AudioCodecs section of the MediaValidator.plist file in the MediaToolbox.framework.

A few things I have noticed:

1. Almost all implementations and documentation on the internet for the HTML5 audio check the MIME type 'audio/mpeg; codecs="mp3"' (without the dot), which fails on OS X because it is not a listed codec in the MediaToolbox framework. Because of this, WebKit will report the 'audio/mpeg; codecs="mp3"' MIME type as "maybe" playable instead of "probably" playable, despite the fact that MP3 is obviously supported. It seems like it would be beneficial to add "mp3" to the AudioCodecs section of the file?

2. All codecs in that section that have a dot or a space, such as ".mp3", ".mp2", "aac " return as not playable, while the others are playable, which led me to believe there was an implementation bug in the isPlayableExtendedMIMEType: function. 

3. I stepped with my debugger into the that function and subsequently the FigMediaValidatorValidateRFC4281ExtendedMIMEType function where I believe I found the source of the bug. There is a line that probably looks something like `char *ret = strsep(&codec, ".")`, where `codec` in my case is ".mp3". This call would set the first instance of "." to a null byte, making the `codec` string now "\0mp3", but the updated pointer to "mp3" somehow is not being used. Consequently, later code references the old pointer "\0mp3" which, of course, is effectively a 0 length string, and causes the logic to fail and return as not playable.

Steps to Reproduce:
1. Call [AVURLAsset isPlayableExtendedMIMEType:@"audio/mpeg; codecs=\".mp3\"];

Expected Results:
YES ==  [AVURLAsset isPlayableExtendedMIMEType:@"audio/mpeg; codecs=\".mp3\"]

and also it would be nice to have:

YES == [AVURLAsset isPlayableExtendedMIMEType:@"audio/mpeg; codecs=\"mp3\"]

Actual Results:
Both return NO.

Version:
Xcode version 6.4 (6E35b)
OS X Yosemite version 10.10.1

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!