| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_FORMATS_MP2T_ES_ADAPTER_VIDEO_H_ | 5 #ifndef MEDIA_FORMATS_MP2T_ES_ADAPTER_VIDEO_H_ |
| 6 #define MEDIA_FORMATS_MP2T_ES_ADAPTER_VIDEO_H_ | 6 #define MEDIA_FORMATS_MP2T_ES_ADAPTER_VIDEO_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // Provide the configuration that applies to the upcoming video buffers. | 47 // Provide the configuration that applies to the upcoming video buffers. |
| 48 void OnConfigChanged(const VideoDecoderConfig& video_decoder_config); | 48 void OnConfigChanged(const VideoDecoderConfig& video_decoder_config); |
| 49 | 49 |
| 50 // Provide a new video buffer. | 50 // Provide a new video buffer. |
| 51 // Returns true when successful. | 51 // Returns true when successful. |
| 52 bool OnNewBuffer( | 52 bool OnNewBuffer( |
| 53 const scoped_refptr<StreamParserBuffer>& stream_parser_buffer); | 53 const scoped_refptr<StreamParserBuffer>& stream_parser_buffer); |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 typedef std::deque<scoped_refptr<StreamParserBuffer> > BufferQueue; | 56 typedef std::deque<scoped_refptr<StreamParserBuffer> > BufferQueue; |
| 57 typedef std::pair<int64, VideoDecoderConfig> ConfigEntry; | 57 typedef std::pair<int64_t, VideoDecoderConfig> ConfigEntry; |
| 58 | 58 |
| 59 void ProcessPendingBuffers(bool flush); | 59 void ProcessPendingBuffers(bool flush); |
| 60 | 60 |
| 61 // Return the PTS of the frame that comes just after |current_pts| in | 61 // Return the PTS of the frame that comes just after |current_pts| in |
| 62 // presentation order. Return kNoTimestamp() if not found. | 62 // presentation order. Return kNoTimestamp() if not found. |
| 63 base::TimeDelta GetNextFramePts(base::TimeDelta current_pts); | 63 base::TimeDelta GetNextFramePts(base::TimeDelta current_pts); |
| 64 | 64 |
| 65 // Replace the leading non key frames by |stream_parser_buffer| | 65 // Replace the leading non key frames by |stream_parser_buffer| |
| 66 // (this one must be a key frame). | 66 // (this one must be a key frame). |
| 67 void ReplaceDiscardedFrames( | 67 void ReplaceDiscardedFrames( |
| 68 const scoped_refptr<StreamParserBuffer>& stream_parser_buffer); | 68 const scoped_refptr<StreamParserBuffer>& stream_parser_buffer); |
| 69 | 69 |
| 70 NewVideoConfigCB new_video_config_cb_; | 70 NewVideoConfigCB new_video_config_cb_; |
| 71 EmitBufferCB emit_buffer_cb_; | 71 EmitBufferCB emit_buffer_cb_; |
| 72 | 72 |
| 73 bool has_valid_config_; | 73 bool has_valid_config_; |
| 74 bool has_valid_frame_; | 74 bool has_valid_frame_; |
| 75 | 75 |
| 76 // Duration of the last video frame. | 76 // Duration of the last video frame. |
| 77 base::TimeDelta last_frame_duration_; | 77 base::TimeDelta last_frame_duration_; |
| 78 | 78 |
| 79 // Association between a video config and a buffer index. | 79 // Association between a video config and a buffer index. |
| 80 std::list<ConfigEntry> config_list_; | 80 std::list<ConfigEntry> config_list_; |
| 81 | 81 |
| 82 // Global index of the first buffer in |buffer_list_|. | 82 // Global index of the first buffer in |buffer_list_|. |
| 83 int64 buffer_index_; | 83 int64_t buffer_index_; |
| 84 | 84 |
| 85 // List of buffer to be emitted and PTS of frames already emitted. | 85 // List of buffer to be emitted and PTS of frames already emitted. |
| 86 BufferQueue buffer_list_; | 86 BufferQueue buffer_list_; |
| 87 std::list<base::TimeDelta> emitted_pts_; | 87 std::list<base::TimeDelta> emitted_pts_; |
| 88 | 88 |
| 89 // Minimum PTS/DTS since the last Reset. | 89 // Minimum PTS/DTS since the last Reset. |
| 90 bool has_valid_initial_timestamp_; | 90 bool has_valid_initial_timestamp_; |
| 91 base::TimeDelta min_pts_; | 91 base::TimeDelta min_pts_; |
| 92 DecodeTimestamp min_dts_; | 92 DecodeTimestamp min_dts_; |
| 93 | 93 |
| 94 // Number of frames to replace with the first valid key frame. | 94 // Number of frames to replace with the first valid key frame. |
| 95 int discarded_frame_count_; | 95 int discarded_frame_count_; |
| 96 | 96 |
| 97 DISALLOW_COPY_AND_ASSIGN(EsAdapterVideo); | 97 DISALLOW_COPY_AND_ASSIGN(EsAdapterVideo); |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 } // namespace mp2t | 100 } // namespace mp2t |
| 101 } // namespace media | 101 } // namespace media |
| 102 | 102 |
| 103 #endif // MEDIA_FORMATS_MP2T_ES_ADAPTER_VIDEO_H_ | 103 #endif // MEDIA_FORMATS_MP2T_ES_ADAPTER_VIDEO_H_ |
| OLD | NEW |