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

Side by Side Diff: media/filters/ffmpeg_demuxer.cc

Issue 2434383003: Handle duplicate media track ids in FFmpegDemuxer (Closed)
Patch Set: Stream ids must be unique only per-stream-type Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | media/filters/ffmpeg_demuxer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/filters/ffmpeg_demuxer.h" 5 #include "media/filters/ffmpeg_demuxer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 MEDIA_LOG(INFO, media_log_) 1280 MEDIA_LOG(INFO, media_log_)
1281 << GetDisplayName() 1281 << GetDisplayName()
1282 << ": skipping invalid or unsupported video track"; 1282 << ": skipping invalid or unsupported video track";
1283 } 1283 }
1284 1284
1285 // This AVStream does not successfully convert. 1285 // This AVStream does not successfully convert.
1286 continue; 1286 continue;
1287 } 1287 }
1288 1288
1289 StreamParser::TrackId track_id = stream->id; 1289 StreamParser::TrackId track_id = stream->id;
1290
1291 if ((codec_type == AVMEDIA_TYPE_AUDIO &&
1292 media_tracks->getAudioConfig(track_id).IsValidConfig()) ||
1293 (codec_type == AVMEDIA_TYPE_VIDEO &&
1294 media_tracks->getVideoConfig(track_id).IsValidConfig())) {
1295 MEDIA_LOG(INFO, media_log_)
1296 << GetDisplayName()
1297 << ": skipping duplicate media stream id=" << track_id;
1298 continue;
1299 }
1300
1290 std::string track_label = streams_[i]->GetMetadata("handler_name"); 1301 std::string track_label = streams_[i]->GetMetadata("handler_name");
1291 std::string track_language = streams_[i]->GetMetadata("language"); 1302 std::string track_language = streams_[i]->GetMetadata("language");
1292 1303
1293 // Some metadata is named differently in FFmpeg for webm files. 1304 // Some metadata is named differently in FFmpeg for webm files.
1294 if (strstr(format_context->iformat->name, "webm") || 1305 if (strstr(format_context->iformat->name, "webm") ||
1295 strstr(format_context->iformat->name, "matroska")) { 1306 strstr(format_context->iformat->name, "matroska")) {
1296 // TODO(servolk): FFmpeg doesn't set stream->id correctly for webm files. 1307 // TODO(servolk): FFmpeg doesn't set stream->id correctly for webm files.
1297 // Need to fix that and use it as track id. crbug.com/323183 1308 // Need to fix that and use it as track id. crbug.com/323183
1298 track_id = 1309 track_id =
1299 static_cast<StreamParser::TrackId>(media_tracks->tracks().size() + 1); 1310 static_cast<StreamParser::TrackId>(media_tracks->tracks().size() + 1);
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 1779
1769 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { 1780 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) {
1770 DCHECK(task_runner_->BelongsToCurrentThread()); 1781 DCHECK(task_runner_->BelongsToCurrentThread());
1771 for (const auto& stream : streams_) { 1782 for (const auto& stream : streams_) {
1772 if (stream) 1783 if (stream)
1773 stream->SetLiveness(liveness); 1784 stream->SetLiveness(liveness);
1774 } 1785 }
1775 } 1786 }
1776 1787
1777 } // namespace media 1788 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/filters/ffmpeg_demuxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698