Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / media / filters / frame_processor_base.cc
index 3e088ed..09b1b86 100644 (file)
 namespace media {
 
 MseTrackBuffer::MseTrackBuffer(ChunkDemuxerStream* stream)
-    : needs_random_access_point_(true),
+    : last_decode_timestamp_(kNoTimestamp()),
+      last_frame_duration_(kNoTimestamp()),
+      highest_presentation_timestamp_(kNoTimestamp()),
+      needs_random_access_point_(true),
       stream_(stream) {
   DCHECK(stream_);
 }
@@ -22,11 +25,23 @@ MseTrackBuffer::~MseTrackBuffer() {
 void MseTrackBuffer::Reset() {
   DVLOG(2) << __FUNCTION__ << "()";
 
+  last_decode_timestamp_ = kNoTimestamp();
+  last_frame_duration_ = kNoTimestamp();
+  highest_presentation_timestamp_ = kNoTimestamp();
   needs_random_access_point_ = true;
 }
 
+void MseTrackBuffer::SetHighestPresentationTimestampIfIncreased(
+    base::TimeDelta timestamp) {
+  if (highest_presentation_timestamp_ == kNoTimestamp() ||
+      timestamp > highest_presentation_timestamp_) {
+    highest_presentation_timestamp_ = timestamp;
+  }
+}
+
 FrameProcessorBase::FrameProcessorBase()
-    : sequence_mode_(false) {}
+    : sequence_mode_(false),
+      group_start_timestamp_(kNoTimestamp()) {}
 
 FrameProcessorBase::~FrameProcessorBase() {
   DVLOG(2) << __FUNCTION__ << "()";
@@ -34,6 +49,14 @@ FrameProcessorBase::~FrameProcessorBase() {
   STLDeleteValues(&track_buffers_);
 }
 
+void FrameProcessorBase::SetGroupStartTimestampIfInSequenceMode(
+    base::TimeDelta timestamp_offset) {
+  DVLOG(2) << __FUNCTION__ << "(" << timestamp_offset.InSecondsF() << ")";
+  DCHECK(kNoTimestamp() != timestamp_offset);
+  if (sequence_mode_)
+    group_start_timestamp_ = timestamp_offset;
+}
+
 bool FrameProcessorBase::AddTrack(StreamParser::TrackId id,
                                   ChunkDemuxerStream* stream) {
   DVLOG(2) << __FUNCTION__ << "(): id=" << id;
@@ -63,4 +86,15 @@ MseTrackBuffer* FrameProcessorBase::FindTrack(StreamParser::TrackId id) {
   return itr->second;
 }
 
+void FrameProcessorBase::NotifyNewMediaSegmentStarting(
+    base::TimeDelta segment_timestamp) {
+  DVLOG(2) << __FUNCTION__ << "(" << segment_timestamp.InSecondsF() << ")";
+
+  for (TrackBufferMap::iterator itr = track_buffers_.begin();
+       itr != track_buffers_.end();
+       ++itr) {
+    itr->second->stream()->OnNewMediaSegment(segment_timestamp);
+  }
+}
+
 }  // namespace media