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

Unified Diff: media/filters/frame_processor.h

Issue 180153003: Implement core of compliant MediaSource coded frame processing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: A couple nits, still not ready for review. Created 6 years, 9 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
Index: media/filters/frame_processor.h
diff --git a/media/filters/frame_processor.h b/media/filters/frame_processor.h
new file mode 100644
index 0000000000000000000000000000000000000000..98e2e2ae14fc578596c676b3778b911a0019080a
--- /dev/null
+++ b/media/filters/frame_processor.h
@@ -0,0 +1,68 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_FILTERS_FRAME_PROCESSOR_H_
+#define MEDIA_FILTERS_FRAME_PROCESSOR_H_
+
+#include "base/basictypes.h"
+#include "base/callback_forward.h"
+#include "base/time/time.h"
+#include "media/base/media_export.h"
+#include "media/base/stream_parser.h"
+#include "media/filters/frame_processor_base.h"
+
+namespace media {
+
+// Helper class that implements Media Source Extension's coded frame processing
+// algorithm.
+class MEDIA_EXPORT FrameProcessor : public FrameProcessorBase {
+ public:
+ typedef base::Callback<void(base::TimeDelta)> UpdateDurationCB;
+ explicit FrameProcessor(const UpdateDurationCB& update_duration_cb);
+ virtual ~FrameProcessor();
+
+ // FrameProcessorBase implementation
+ virtual void SetSequenceMode(bool sequence_mode) OVERRIDE;
+ virtual void SetGroupStartTimestampIfInSequenceMode(
+ base::TimeDelta timestamp_offset) OVERRIDE;
+ virtual bool ProcessFrames(const StreamParser::BufferQueue& audio_buffers,
+ const StreamParser::BufferQueue& video_buffers,
+ const StreamParser::TextBufferQueueMap& text_map,
+ base::TimeDelta append_window_start,
+ base::TimeDelta append_window_end,
+ bool* new_media_segment,
+ base::TimeDelta* timestamp_offset) OVERRIDE;
+
+ private:
+ // Helper that processes one frame with the coded frame processing algorithm.
+ // Returns false on error or true on success.
+ bool ProcessFrame(scoped_refptr<StreamParserBuffer> frame,
+ base::TimeDelta append_window_start,
+ base::TimeDelta append_window_end,
+ base::TimeDelta* timestamp_offset,
+ bool* new_media_segment);
+
+ // Sets the need random access point flag on all track buffers to true.
+ void SetAllTrackBuffersNeedRandomAccessPoint();
+
+ // Tracks the MSE coded frame processing variable of same name.
+ // Its value is meaningless if |group_start_timestamp_set_| is false.
+ // |group_start_timestamp_set_| is initialized to false.
+ base::TimeDelta group_start_timestamp_;
+ bool group_start_timestamp_set_;
+
+ // Tracks the MSE coded frame processing variable of same name. It stores the
+ // highest presentation end timestamp encountered in the current coded frame
+ // group. It is set to 0 when the assocated SourceBuffer is created and gets
+ // updated by ProcessFrames().
+ base::TimeDelta highest_presentation_end_timestamp_;
+
+ UpdateDurationCB update_duration_cb_;
+
+ DISALLOW_COPY_AND_ASSIGN(FrameProcessor);
+};
+
+} // namespace media
+
+#endif // MEDIA_FILTERS_FRAME_PROCESSOR_H_

Powered by Google App Engine
This is Rietveld 408576698