Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_FILTERS_FRAME_PROCESSOR_H_ | |
| 6 #define MEDIA_FILTERS_FRAME_PROCESSOR_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/callback_forward.h" | |
| 10 #include "base/time/time.h" | |
| 11 #include "media/base/media_export.h" | |
| 12 #include "media/base/stream_parser.h" | |
| 13 #include "media/filters/frame_processor_base.h" | |
| 14 | |
| 15 namespace media { | |
| 16 | |
| 17 // Helper class that implements Media Source Extension's coded frame processing | |
| 18 // algorithm. | |
| 19 class MEDIA_EXPORT FrameProcessor : public FrameProcessorBase { | |
| 20 public: | |
| 21 typedef base::Callback<void(base::TimeDelta)> UpdateDurationCB; | |
| 22 explicit FrameProcessor(const UpdateDurationCB& update_duration_cb); | |
| 23 virtual ~FrameProcessor(); | |
| 24 | |
| 25 // FrameProcessorBase implementation | |
| 26 virtual void SetSequenceMode(bool sequence_mode) OVERRIDE; | |
| 27 virtual void SetGroupStartTimestampIfInSequenceMode( | |
| 28 base::TimeDelta timestamp_offset) OVERRIDE; | |
| 29 virtual bool ProcessFrames(const StreamParser::BufferQueue& audio_buffers, | |
| 30 const StreamParser::BufferQueue& video_buffers, | |
| 31 const StreamParser::TextBufferQueueMap& text_map, | |
| 32 base::TimeDelta append_window_start, | |
| 33 base::TimeDelta append_window_end, | |
| 34 bool* new_media_segment, | |
| 35 base::TimeDelta* timestamp_offset) OVERRIDE; | |
| 36 | |
| 37 private: | |
| 38 // Helper that processes one frame with the coded frame processing algorithm. | |
| 39 // Returns false on error or true on success. | |
| 40 bool ProcessFrame(scoped_refptr<StreamParserBuffer> frame, | |
| 41 base::TimeDelta append_window_start, | |
| 42 base::TimeDelta append_window_end, | |
| 43 base::TimeDelta* timestamp_offset, | |
| 44 bool* new_media_segment); | |
| 45 | |
| 46 // Sets the need random access point flag on all track buffers to true. | |
| 47 void SetAllTrackBuffersNeedRandomAccessPoint(); | |
| 48 | |
| 49 // Tracks the MSE coded frame processing variable of same name. | |
| 50 // Its value is meaningless if |group_start_timestamp_set_| is false. | |
| 51 // |group_start_timestamp_set_| is initialized to false. | |
| 52 base::TimeDelta group_start_timestamp_; | |
| 53 bool group_start_timestamp_set_; | |
|
acolwell GONE FROM CHROMIUM
2014/05/08 00:06:43
nit: Any reason not to use kNoTimestamp() to track
wolenetz
2014/05/08 02:35:28
None now. Done.
| |
| 54 | |
| 55 // Tracks the MSE coded frame processing variable of same name. It stores the | |
| 56 // highest coded frame end timestamp across all coded frames in the current | |
| 57 // coded frame group. It is set to 0 when the SourceBuffer object is created | |
| 58 // and gets updated by ProcessFrames(). | |
| 59 base::TimeDelta group_end_timestamp_; | |
| 60 | |
| 61 UpdateDurationCB update_duration_cb_; | |
| 62 | |
| 63 DISALLOW_COPY_AND_ASSIGN(FrameProcessor); | |
| 64 }; | |
| 65 | |
| 66 } // namespace media | |
| 67 | |
| 68 #endif // MEDIA_FILTERS_FRAME_PROCESSOR_H_ | |
| OLD | NEW |