Chromium Code Reviews| Index: media/filters/chunk_demuxer.cc |
| diff --git a/media/filters/chunk_demuxer.cc b/media/filters/chunk_demuxer.cc |
| index b7244b93317c19dfd472a3dde125431327b4df1b..7ab739ad0873a69ed9f38da99f1d9646736a8eab 100644 |
| --- a/media/filters/chunk_demuxer.cc |
| +++ b/media/filters/chunk_demuxer.cc |
| @@ -118,18 +118,25 @@ class SourceState { |
| // ChunkDemuxerStreams managed by this object. |
| void Remove(TimeDelta start, TimeDelta end, TimeDelta duration); |
| - // Sets |timestamp_offset_| if possible. |
| - // Returns if the offset was set. Returns false if the offset could not be |
| - // updated at this time. |
| + // Sets user-specified |timestamp_offset_| if possible. |
| + // Returns true if the offset was set. Returns false if the offset could not |
| + // be set at this time. |
| bool SetTimestampOffset(TimeDelta timestamp_offset); |
| + // Gets the updated timestamp offset or indication that it has not been |
| + // updated. |
| + // If |using_user_specified_timestamp_offset_| is true, meaning |
|
acolwell GONE FROM CHROMIUM
2014/02/25 21:50:41
nit: I wonder if the name should be something like
wolenetz
2014/02/25 22:56:29
Done. That does make more sense :)
|
| + // |timestamp_offset_| was most recently set by SetTimestampOffset() or |
| + // this SourceState's construction, returns kNoTimestamp(). |
| + // Otherwise, returns the updated |timestamp_offset_| resulting from |
| + // operations like "sequence" mode Append() coded frame processing. |
| + TimeDelta GetUpdatedTimestampOffset() const; |
| + |
| // Sets |sequence_mode_| to |sequence_mode| if possible. |
| // Returns true if the mode update was allowed. Returns false if the mode |
| // could not be updated at this time. |
| bool SetSequenceMode(bool sequence_mode); |
| - TimeDelta timestamp_offset() const { return timestamp_offset_; } |
| - |
| void set_append_window_start(TimeDelta start) { |
| append_window_start_ = start; |
| } |
| @@ -224,6 +231,10 @@ class SourceState { |
| // The offset to apply to media segment timestamps. |
| TimeDelta timestamp_offset_; |
| + // Flag that is true only if |timestamp_offset_| was most recently set by |
| + // SetTimestampOffset() or this SourceState's construction. |
| + bool using_user_specified_timestamp_offset_; |
| + |
| // Tracks the mode by which appended media is processed. If true, then |
| // appended media is processed using "sequence" mode. Otherwise, appended |
| // media is processed using "segments" mode. |
| @@ -365,6 +376,7 @@ SourceState::SourceState(scoped_ptr<StreamParser> stream_parser, |
| const IncreaseDurationCB& increase_duration_cb) |
| : create_demuxer_stream_cb_(create_demuxer_stream_cb), |
| increase_duration_cb_(increase_duration_cb), |
| + using_user_specified_timestamp_offset_(true), |
| sequence_mode_(false), |
| append_window_end_(kInfiniteDuration()), |
| new_media_segment_(false), |
| @@ -412,10 +424,19 @@ bool SourceState::SetTimestampOffset(TimeDelta timestamp_offset) { |
| if (parsing_media_segment_) |
| return false; |
| + using_user_specified_timestamp_offset_ = true; |
| timestamp_offset_ = timestamp_offset; |
| + |
| return true; |
| } |
| +TimeDelta SourceState::GetUpdatedTimestampOffset() const { |
| + if (using_user_specified_timestamp_offset_) |
| + return kNoTimestamp(); |
| + |
| + return timestamp_offset_; |
| +} |
| + |
| bool SourceState::SetSequenceMode(bool sequence_mode) { |
| if (parsing_media_segment_) |
| return false; |
| @@ -1559,6 +1580,14 @@ bool ChunkDemuxer::SetTimestampOffset(const std::string& id, TimeDelta offset) { |
| return source_state_map_[id]->SetTimestampOffset(offset); |
| } |
| +TimeDelta ChunkDemuxer::GetUpdatedTimestampOffset(const std::string& id) { |
| + base::AutoLock auto_lock(lock_); |
| + DVLOG(1) << "GetUpdatedTimestampOffset(" << id << ")"; |
| + CHECK(IsValidId(id)); |
| + |
| + return source_state_map_[id]->GetUpdatedTimestampOffset(); |
| +} |
| + |
| bool ChunkDemuxer::SetSequenceMode(const std::string& id, |
| bool sequence_mode) { |
| base::AutoLock auto_lock(lock_); |