Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Unified Diff: media/formats/mp4/mp4_stream_parser.cc

Issue 1826583003: MSE: Record counts of detected MSE audio, video and text tracks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Yet another attempt to fix that link failure. MEDIA_EXPORT should do it! Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/formats/mp4/fourccs.h ('k') | media/formats/mp4/mp4_stream_parser_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/formats/mp4/mp4_stream_parser.cc
diff --git a/media/formats/mp4/mp4_stream_parser.cc b/media/formats/mp4/mp4_stream_parser.cc
index 4f72c5e1a7a48a6f30e701190d36518b9659a61b..49acc874863e6a0720061535600b5f271e3e9ed3 100644
--- a/media/formats/mp4/mp4_stream_parser.cc
+++ b/media/formats/mp4/mp4_stream_parser.cc
@@ -192,6 +192,9 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
scoped_ptr<MediaTracks> media_tracks(new MediaTracks());
AudioDecoderConfig audio_config;
VideoDecoderConfig video_config;
+ int detected_audio_track_count = 0;
+ int detected_video_track_count = 0;
+ int detected_text_track_count = 0;
for (std::vector<Track>::const_iterator track = moov_->tracks.begin();
track != moov_->tracks.end(); ++track) {
@@ -215,7 +218,11 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
RCHECK(desc_idx > 0);
desc_idx -= 1; // BMFF descriptor index is one-based
- if (track->media.handler.type == kAudio && !audio_config.IsValidConfig()) {
+ if (track->media.handler.type == kAudio) {
+ detected_audio_track_count++;
+ if (audio_config.IsValidConfig())
+ continue; // Skip other audio tracks once we found a supported one.
+
RCHECK(!samp_descr.audio_entries.empty());
// It is not uncommon to find otherwise-valid files with incorrect sample
@@ -314,8 +321,14 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
media_tracks->AddAudioTrack(
audio_config, base::UintToString(audio_track_id_), "main",
track->media.handler.name, track->media.header.language());
+ continue;
}
- if (track->media.handler.type == kVideo && !video_config.IsValidConfig()) {
+
+ if (track->media.handler.type == kVideo) {
+ detected_video_track_count++;
+ if (video_config.IsValidConfig())
+ continue; // Skip other video tracks once we found a supported one.
+
RCHECK(!samp_descr.video_entries.empty());
if (desc_idx >= samp_descr.video_entries.size())
desc_idx = 0;
@@ -359,7 +372,15 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
media_tracks->AddVideoTrack(
video_config, base::UintToString(video_track_id_), "main",
track->media.handler.name, track->media.header.language());
+ continue;
}
+
+ // TODO(wolenetz): Investigate support in MSE and Chrome MSE for CEA 608/708
+ // embedded caption data in video track. At time of init segment parsing, we
+ // don't have this data (unless maybe by SourceBuffer's mimetype).
+ // See https://crbug.com/597073
+ if (track->media.handler.type == kText)
+ detected_text_track_count++;
}
if (!moov_->pssh.empty())
@@ -389,8 +410,12 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
DVLOG(1) << "liveness: " << params.liveness;
- if (!init_cb_.is_null())
+ if (!init_cb_.is_null()) {
+ params.detected_audio_track_count = detected_audio_track_count;
+ params.detected_video_track_count = detected_video_track_count;
+ params.detected_text_track_count = detected_text_track_count;
base::ResetAndReturn(&init_cb_).Run(params);
+ }
return true;
}
« no previous file with comments | « media/formats/mp4/fourccs.h ('k') | media/formats/mp4/mp4_stream_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698