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

Unified Diff: media/filters/chunk_demuxer.cc

Issue 2050043002: Generate and assign media track ids in demuxers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@use-streamparser-trackid
Patch Set: rebase to ToT Created 4 years, 6 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/filters/chunk_demuxer.h ('k') | media/filters/chunk_demuxer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/chunk_demuxer.cc
diff --git a/media/filters/chunk_demuxer.cc b/media/filters/chunk_demuxer.cc
index 9b1bbd7fdaec9dae76d16d10455f03a10be56719..83711f12b7f663deea3b74c893864551d0a903d9 100644
--- a/media/filters/chunk_demuxer.cc
+++ b/media/filters/chunk_demuxer.cc
@@ -15,8 +15,10 @@
#include "base/macros.h"
#include "base/metrics/histogram_macros.h"
#include "base/stl_util.h"
+#include "base/strings/string_number_conversions.h"
#include "media/base/audio_decoder_config.h"
#include "media/base/bind_to_current_loop.h"
+#include "media/base/media_tracks.h"
#include "media/base/stream_parser_buffer.h"
#include "media/base/timestamp_constants.h"
#include "media/base/video_decoder_config.h"
@@ -28,13 +30,14 @@ using base::TimeDelta;
namespace media {
ChunkDemuxerStream::ChunkDemuxerStream(Type type,
- bool splice_frames_enabled)
+ bool splice_frames_enabled,
+ MediaTrack::Id media_track_id)
: type_(type),
liveness_(DemuxerStream::LIVENESS_UNKNOWN),
+ media_track_id_(media_track_id),
state_(UNINITIALIZED),
splice_frames_enabled_(splice_frames_enabled),
- partial_append_window_trimming_enabled_(false) {
-}
+ partial_append_window_trimming_enabled_(false) {}
void ChunkDemuxerStream::StartReturningData() {
DVLOG(1) << "ChunkDemuxerStream::StartReturningData()";
@@ -1003,26 +1006,39 @@ void ChunkDemuxer::OnSourceInitDone(
base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK);
}
+// static
+MediaTrack::Id ChunkDemuxer::GenerateMediaTrackId() {
+ static unsigned g_track_count = 0;
+ return base::UintToString(++g_track_count);
+}
+
ChunkDemuxerStream* ChunkDemuxer::CreateDemuxerStream(
DemuxerStream::Type type) {
+ // New ChunkDemuxerStreams can be created only during initialization segment
+ // processing, which happens when a new chunk of data is appended and the
+ // lock_ must be held by ChunkDemuxer::AppendData.
+ lock_.AssertAcquired();
+
+ MediaTrack::Id media_track_id = GenerateMediaTrackId();
+
switch (type) {
case DemuxerStream::AUDIO:
if (audio_)
return NULL;
- audio_.reset(
- new ChunkDemuxerStream(DemuxerStream::AUDIO, splice_frames_enabled_));
+ audio_.reset(new ChunkDemuxerStream(
+ DemuxerStream::AUDIO, splice_frames_enabled_, media_track_id));
return audio_.get();
break;
case DemuxerStream::VIDEO:
if (video_)
return NULL;
- video_.reset(
- new ChunkDemuxerStream(DemuxerStream::VIDEO, splice_frames_enabled_));
+ video_.reset(new ChunkDemuxerStream(
+ DemuxerStream::VIDEO, splice_frames_enabled_, media_track_id));
return video_.get();
break;
case DemuxerStream::TEXT: {
- return new ChunkDemuxerStream(DemuxerStream::TEXT,
- splice_frames_enabled_);
+ return new ChunkDemuxerStream(DemuxerStream::TEXT, splice_frames_enabled_,
+ media_track_id);
break;
}
case DemuxerStream::UNKNOWN:
« no previous file with comments | « media/filters/chunk_demuxer.h ('k') | media/filters/chunk_demuxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698