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

Closed Caption (CEA-608) tracks do not respect track definition of HLS Master Playlist. #3033

Closed
gergely-sallai opened this issue Jul 7, 2017 · 1 comment
Labels

Comments

@gergely-sallai
Copy link

gergely-sallai commented Jul 7, 2017

Issue description

Closed Caption (CEA-608) tracks do not respect track definition of HLS Master Playlist.
CEA-608 tracks are parsed correctly from the Master Playlist, but SeiExtractor does not seem to use the extracted ID, rather it generates new ones for the Closed Caption tracks extracted from the chunks.
This results in ExoPlayer.EventListener.onTracksChanged reporting back a CC track with generated id.
The expected behaviour would be to have the same name reported back that the MasterPlaylist contains.

For example, given an HLS playlist with Closed Caption track:

...
#EXT-X-MEDIA:TYPE=CLOSED-CAPTIONS,GROUP-ID="cc1",LANGUAGE="en",NAME="English",AUTOSELECT=YES,DEFAULT=YES,INSTREAM-ID="CC1"
...

onTracksChanged will have something like this:

Renderer:2 [
  Group:0, adaptive_supported=N/A [
    [X] Track:0, id=1/8219, mimeType=application/cea-608, language=en, supported=YES
  ]
]

The id in this case should be "English".

Reproduction steps

Open any HLS stream that has a CEA-608 track defined in its Master Playlist (and has CC in the h264 stream), wait for ExoPlayer.EventListener.onTracksChanged callback and print out the results.
Compare the id of the CEA-608 track with the playlist.

Link to test content

Copied from ExoPlayer's media.exolist.json:
Apple master playlist advanced (TS): https://tungsten.aaplimg.com/VOD/bipbop_adv_example_v2/master.m3u8

Version of ExoPlayer being used

Tested on:
r2.4.1
dev-v2: 7524228

This was working in r2.2.0.

Device(s) and version(s) of Android being used

Samsung Galaxy S3 (GT-I9300), Android 4.3
Sony Xperia X (F5121), Android 7.1.1
I don't think this is a device specific issue.

Further info

I debugged the ExoPlayer demo app and found that HlsPlaylistParser.java correctly parses the CC track.
Later when DefaultTsPayloadReaderFactory.buildSeiReader(EsInfo) is called the flag FLAG_OVERRIDE_CAPTION_DESCRIPTORS is set. A new SeiReader is built with the parsed closed caption formats.
SeiReader.createTracks(ExtractorOutput, TrackIdGenerator) however does not seem to use the id of the closedCatpionFormats provided at instantiation, rather it generates a new one.
I made the following changes, and it seems to fix the issue. But I'm not sure if this is the correct approach or if I'm breaking some other functionality somewhere else.

diff --git a/library/core/src/main/java/com/google/android/exoplayer2/extractor/ts/SeiReader.java b/library/core/src/main/java/com/google/android/exoplayer2/extractor/ts/SeiReader.java
index 1e5d480ea..9b68b3d02 100644
--- a/library/core/src/main/java/com/google/android/exoplayer2/extractor/ts/SeiReader.java
+++ b/library/core/src/main/java/com/google/android/exoplayer2/extractor/ts/SeiReader.java
@@ -51,7 +51,8 @@ import java.util.List;
       Assertions.checkArgument(MimeTypes.APPLICATION_CEA608.equals(channelMimeType)
           || MimeTypes.APPLICATION_CEA708.equals(channelMimeType),
           "Invalid closed caption mime type provided: " + channelMimeType);
-      output.format(Format.createTextSampleFormat(idGenerator.getFormatId(), channelMimeType, null,
+      final String formatId = channelFormat.id == null ? idGenerator.getFormatId() : channelFormat.id;
+      output.format(Format.createTextSampleFormat(formatId, channelMimeType, null,
           Format.NO_VALUE, channelFormat.selectionFlags, channelFormat.language,
           channelFormat.accessibilityChannel, null));
       outputs[i] = output;

A full bug report captured from the device

A full bug report is not provided, as I'm not sure it would be useful. Please tell me if you need one.

07-06 18:05:54.474 8464-8464/com.google.android.exoplayer2.demo D/EventLogger: state [0.02, true, I]
07-06 18:05:54.475 8464-8464/com.google.android.exoplayer2.demo I/PlayerActivity: buildMediaSource uri: https://tungsten.aaplimg.com/VOD/bipbop_adv_example_v2/master.m3u8
07-06 18:05:54.487 8464-8464/com.google.android.exoplayer2.demo D/EventLogger: state [0.03, true, B]
07-06 18:05:55.642 8464-8464/com.google.android.exoplayer2.demo D/EventLogger: sourceInfo [periodCount=1, windowCount=1
07-06 18:05:55.643 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:   period [600.00]
07-06 18:05:55.643 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:   window [600.00, true, false]
07-06 18:05:55.643 8464-8464/com.google.android.exoplayer2.demo D/EventLogger: ]
07-06 18:05:55.662 8464-8464/com.google.android.exoplayer2.demo D/EventLogger: loading [true]
07-06 18:05:56.830 8464-8464/com.google.android.exoplayer2.demo D/EventLogger: Tracks [
07-06 18:05:56.830 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:   Renderer:0 [
07-06 18:05:56.830 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:     Group:0, adaptive_supported=YES [
07-06 18:05:56.830 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:       [X] Track:0, id=0, mimeType=video/avc, bitrate=2218327, res=960x540, supported=YES
07-06 18:05:56.830 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:       [X] Track:1, id=1, mimeType=video/avc, bitrate=8144656, res=1920x1080, supported=YES
07-06 18:05:56.830 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:       [X] Track:2, id=2, mimeType=video/avc, bitrate=6307144, res=1920x1080, supported=YES
07-06 18:05:56.830 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:       [X] Track:3, id=3, mimeType=video/avc, bitrate=4775338, res=1920x1080, supported=YES
07-06 18:05:56.830 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:       [X] Track:4, id=4, mimeType=video/avc, bitrate=3240596, res=1280x720, supported=YES
07-06 18:05:56.830 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:       [X] Track:5, id=5, mimeType=video/avc, bitrate=1292926, res=768x432, supported=YES
07-06 18:05:56.831 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:       [X] Track:6, id=6, mimeType=video/avc, bitrate=914722, res=640x360, supported=YES
07-06 18:05:56.831 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:       [X] Track:7, id=7, mimeType=video/avc, bitrate=541239, res=480x270, supported=YES
07-06 18:05:56.831 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:     ]
07-06 18:05:56.831 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:   ]
07-06 18:05:56.831 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:   Renderer:1 [
07-06 18:05:56.831 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:     Group:0, adaptive_supported=N/A [
07-06 18:05:56.831 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:       [X] Track:0, id=English, mimeType=audio/mp4a-latm, channels=2, sample_rate=48000, language=en, supported=YES
07-06 18:05:56.831 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:     ]
07-06 18:05:56.831 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:     Group:1, adaptive_supported=N/A [
07-06 18:05:56.831 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:       [ ] Track:0, id=English, mimeType=audio/ac3, channels=6, sample_rate=48000, language=en, supported=NO_UNSUPPORTED_TYPE
07-06 18:05:56.831 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:     ]
07-06 18:05:56.831 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:     Group:2, adaptive_supported=N/A [
07-06 18:05:56.831 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:       [ ] Track:0, id=English, mimeType=audio/eac3, channels=6, sample_rate=48000, language=en, supported=NO_UNSUPPORTED_TYPE
07-06 18:05:56.831 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:     ]
07-06 18:05:56.831 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:   ]
07-06 18:05:56.831 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:   Renderer:2 [
07-06 18:05:56.832 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:     Group:0, adaptive_supported=N/A [
07-06 18:05:56.832 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:       [X] Track:0, id=1/8219, mimeType=application/cea-608, language=en, supported=YES
07-06 18:05:56.832 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:     ]
07-06 18:05:56.832 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:     Group:1, adaptive_supported=N/A [
07-06 18:05:56.832 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:       [ ] Track:0, id=English, mimeType=text/vtt, language=en, supported=YES
07-06 18:05:56.832 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:     ]
07-06 18:05:56.832 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:   ]
07-06 18:05:56.832 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:   Renderer:3 [
07-06 18:05:56.832 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:     Group:0, adaptive_supported=N/A [
07-06 18:05:56.832 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:       [X] Track:0, id=1/21, mimeType=application/id3, supported=YES
07-06 18:05:56.832 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:     ]
07-06 18:05:56.832 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:     Group:1, adaptive_supported=N/A [
07-06 18:05:56.832 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:       [ ] Track:0, id=1, mimeType=application/id3, supported=YES
07-06 18:05:56.832 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:     ]
07-06 18:05:56.832 8464-8464/com.google.android.exoplayer2.demo D/EventLogger:   ]
07-06 18:05:56.832 8464-8464/com.google.android.exoplayer2.demo D/EventLogger: ]
07-06 18:05:56.849 8464-8464/com.google.android.exoplayer2.demo D/EventLogger: videoEnabled [2.39]
07-06 18:05:56.850 8464-8464/com.google.android.exoplayer2.demo D/EventLogger: audioEnabled [2.39]
07-06 18:05:56.875 8464-8464/com.google.android.exoplayer2.demo D/EventLogger: audioDecoderInitialized [2.42, OMX.google.aac.decoder]
07-06 18:05:56.875 8464-8464/com.google.android.exoplayer2.demo D/EventLogger: audioFormatChanged [2.42, id=0, mimeType=audio/mp4a-latm, channels=2, sample_rate=48000]
07-06 18:05:56.915 8464-8464/com.google.android.exoplayer2.demo D/EventLogger: audioSessionId [1953]
07-06 18:05:57.244 8464-8464/com.google.android.exoplayer2.demo D/EventLogger: videoDecoderInitialized [2.79, OMX.qcom.video.decoder.avc]
07-06 18:05:57.244 8464-8464/com.google.android.exoplayer2.demo D/EventLogger: videoFormatChanged [2.79, id=1/27, mimeType=video/avc, res=960x540]
07-06 18:05:57.245 8464-8464/com.google.android.exoplayer2.demo D/EventLogger: videoFormatChanged [2.79, id=1/27, mimeType=video/avc, res=1920x1080]
07-06 18:05:57.764 8464-8464/com.google.android.exoplayer2.demo D/EventLogger: videoSizeChanged [1920, 1080]
07-06 18:05:57.796 8464-8464/com.google.android.exoplayer2.demo D/EventLogger: renderedFirstFrame [Surface(name=null)/@0x456ad1d]
07-06 18:05:59.081 8464-8464/com.google.android.exoplayer2.demo D/EventLogger: state [4.63, true, R]
07-06 18:06:05.987 8464-8464/com.google.android.exoplayer2.demo D/EventLogger: videoDisabled [11.53]
07-06 18:06:05.988 8464-8464/com.google.android.exoplayer2.demo D/EventLogger: audioDisabled [11.53]
@ojw28 ojw28 added the bug label Jul 10, 2017
@ojw28
Copy link
Contributor

ojw28 commented Jul 11, 2017

Thanks for the detailed report. We'll push a fix for this shortly.

ojw28 added a commit that referenced this issue Jul 12, 2017
Issue: #3033

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161512537
@ojw28 ojw28 closed this as completed Jul 12, 2017
ojw28 added a commit that referenced this issue Jul 19, 2017
Issue: #3033

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161512537
@google google locked and limited conversation to collaborators Nov 10, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants