Index: media/filters/chunk_demuxer.cc |
diff --git a/media/filters/chunk_demuxer.cc b/media/filters/chunk_demuxer.cc |
index 0c5608943725b41383b8aa278b056c792dbecf60..1cc7acbab7686dbe4990a6f59d76097fa8830e55 100644 |
--- a/media/filters/chunk_demuxer.cc |
+++ b/media/filters/chunk_demuxer.cc |
@@ -93,16 +93,17 @@ class SourceState { |
typedef base::Callback<void( |
ChunkDemuxerStream*, const TextTrackConfig&)> NewTextTrackCB; |
- // First parameter - Indicates initialization success. Set to true if |
- // initialization was successful. False if an error |
- // occurred. |
- // Second parameter - Indicates the stream duration. Only contains a valid |
- // value if the first parameter is true. |
- // Third parameter - Indicates the source Time associated with |
+ // success - True if initialization was successful, false otherwise. |
+ // duration - Stream duration. Only valid if |success| is true. |
+ // timeline_offset - Indicates the source Time associated with |
// presentation timestamp 0. A null Time is returned if |
// no mapping to Time exists. Only contains a |
- // valid value if the first parameter is true. |
- typedef base::Callback<void(bool, TimeDelta, base::Time)> InitCB; |
+ // valid value if |success| is true. |
+ // live_mode - True when the stream is a live stream. |
+ typedef base::Callback<void(bool success, |
+ TimeDelta duration, |
+ base::Time timeline_offset, |
+ bool live_mode)> InitCB; |
SourceState( |
scoped_ptr<StreamParser> stream_parser, |
@@ -195,7 +196,8 @@ class SourceState { |
void OnSourceInitDone(bool success, |
TimeDelta duration, |
base::Time timeline_offset, |
- bool auto_update_timestamp_offset); |
+ bool auto_update_timestamp_offset, |
+ bool live_mode); |
CreateDemuxerStreamCB create_demuxer_stream_cb_; |
NewTextTrackCB new_text_track_cb_; |
@@ -703,10 +705,11 @@ bool SourceState::OnNewBuffers( |
void SourceState::OnSourceInitDone(bool success, |
TimeDelta duration, |
base::Time timeline_offset, |
- bool auto_update_timestamp_offset) { |
+ bool auto_update_timestamp_offset, |
+ bool live_mode) { |
auto_update_timestamp_offset_ = auto_update_timestamp_offset; |
base::ResetAndReturn(&init_cb_).Run( |
- success, duration, timeline_offset); |
+ success, duration, timeline_offset, live_mode); |
} |
ChunkDemuxerStream::ChunkDemuxerStream(Type type, bool splice_frames_enabled) |
@@ -990,6 +993,7 @@ ChunkDemuxer::ChunkDemuxer(const base::Closure& open_cb, |
log_cb_(log_cb), |
duration_(kNoTimestamp()), |
user_specified_duration_(-1), |
+ live_mode_(false), |
splice_frames_enabled_(splice_frames_enabled) { |
DCHECK(!open_cb_.is_null()); |
DCHECK(!need_key_cb_.is_null()); |
@@ -1080,6 +1084,10 @@ base::Time ChunkDemuxer::GetTimelineOffset() const { |
return timeline_offset_; |
} |
+bool ChunkDemuxer::IsLiveMode() const { |
+ return live_mode_; |
+} |
+ |
void ChunkDemuxer::StartWaitingForSeek(TimeDelta seek_time) { |
DVLOG(1) << "StartWaitingForSeek()"; |
base::AutoLock auto_lock(lock_); |
@@ -1497,8 +1505,10 @@ bool ChunkDemuxer::IsSeekWaitingForData_Locked() const { |
return false; |
} |
-void ChunkDemuxer::OnSourceInitDone(bool success, TimeDelta duration, |
- base::Time timeline_offset) { |
+void ChunkDemuxer::OnSourceInitDone(bool success, |
+ TimeDelta duration, |
+ base::Time timeline_offset, |
+ bool live_mode) { |
DVLOG(1) << "OnSourceInitDone(" << success << ", " |
<< duration.InSecondsF() << ")"; |
lock_.AssertAcquired(); |
@@ -1523,10 +1533,13 @@ void ChunkDemuxer::OnSourceInitDone(bool success, TimeDelta duration, |
timeline_offset_ = timeline_offset; |
} |
+ live_mode_ |= live_mode; |
+ |
// Wait until all streams have initialized. |
if ((!source_id_audio_.empty() && !audio_) || |
- (!source_id_video_.empty() && !video_)) |
+ (!source_id_video_.empty() && !video_)) { |
return; |
+ } |
SeekAllSources(GetStartTime()); |
StartReturningData(); |