Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix order of REGEX_METHOD pattern #4145

Closed
wants to merge 1 commit into from

Conversation

TakuSemba
Copy link
Contributor

I'm trying to play a content of HLS + WideVine + cenc , and I found that the content is not playing properly on pre-Nougat devices.

HLS + WideVine + cenc should be playable according to this

After I debugging the code, it seems like ExoPlayer judges the content cbcs mode, even if the content is cenc mode at this point.

Shouldn't METHOD_SAMPLE_AES be put after METHOD_SAMPLE_AES_CENC , METHOD_SAMPLE_AES_CTR ??, otherwise METHOD_SAMPLE_AES_CENC, METHOD_SAMPLE_AES_CTR would never match.

#EXTM3U
#EXT-X-VERSION:6
## Generated with https://github.com/google/shaka-packager version 2453c93f91-release
#EXT-X-TARGETDURATION:12
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-MAP:URI="init.mp4"
#EXTINF:10.000,
1.m4s
#EXT-X-DISCONTINUITY
#EXT-X-KEY:METHOD=SAMPLE-AES-CTR,URI="data:text/plain;base64,AAAAN3Bzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABciD3Rlc3QgY29udGVudCBpZEjj3JWbBg==",KEYID=0x6D76F25CB17F5E16B8EAEF6BBF582D8E,KEYFORMATVERSIONS="1",KEYFORMAT="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"
#EXTINF:10.792,
2.m4s
#EXTINF:9.792,
3.m4s
#EXTINF:10.000,
  private static final String METHOD_NONE = "NONE";
  private static final String METHOD_AES_128 = "AES-128";
  private static final String METHOD_SAMPLE_AES = "SAMPLE-AES";
  // Replaced by METHOD_SAMPLE_AES_CTR. Keep for backward compatibility.
  private static final String METHOD_SAMPLE_AES_CENC = "SAMPLE-AES-CENC";
  private static final String METHOD_SAMPLE_AES_CTR = "SAMPLE-AES-CTR";
  private static final Pattern REGEX_METHOD =
      Pattern.compile(
          "METHOD=("
              + METHOD_NONE
              + "|"
              + METHOD_AES_128
              + "|"
              + METHOD_SAMPLE_AES
              + "|"
              + METHOD_SAMPLE_AES_CENC
              + "|"
              + METHOD_SAMPLE_AES_CTR
              + ")");
Matcher matcher = REGEX_METHOD.matcher("#EXT-X-KEY:METHOD=SAMPLE-AES-CTR,URI=\"data:text/plain;base64,AAAAN3Bzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABciD3Rlc3QgY29udGVudCBpZEjj3JWbBg==\",KEYID=0x6D76F25CB17F5E16B8EAEF6BBF582D8E,KEYFORMATVERSIONS=\"1\",KEYFORMAT=\"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed\"");
matcher.find() ? matcher.group(1) : null;
// ↑ this returns "SAMPLE-AES" because SAMPLE-AES is before METHOD_SAMPLE_AES_CTR

@AquilesCanta
Copy link
Contributor

Hi, thanks for diagnosing and reporting! This is indeed a bug and we will fix it. But it's probably better not to depend on the method ordering. We will soon push a fix along with tests for it. A commit reference will appear here.

@TakuSemba
Copy link
Contributor Author

TakuSemba commented Apr 18, 2018

We will soon push a fix along with tests for it. A commit reference will appear here.

thanks, does it mean my commit will be merged with your changes?

ojw28 pushed a commit that referenced this pull request May 7, 2018
Issue:#4145

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193494319
@ojw28
Copy link
Contributor

ojw28 commented May 7, 2018

Closing as a different fixed has now been merged. Thanks!

@ojw28 ojw28 closed this May 7, 2018
@TakuSemba TakuSemba deleted the fix-pattern branch June 13, 2018 02:37
@google google locked and limited conversation to collaborators Sep 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants