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

Side by Side Diff: media/formats/mp2t/mp2t_stream_parser.h

Issue 539343002: Make the timestamp unroll offset consistent accross PES pids. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Prevent negative timestamps. Created 6 years, 3 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 unified diff | Download patch
OLDNEW
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_MP2T_STREAM_PARSER_H_ 5 #ifndef MEDIA_FORMATS_MP2T_MP2T_STREAM_PARSER_H_
6 #define MEDIA_FORMATS_MP2T_MP2T_STREAM_PARSER_H_ 6 #define MEDIA_FORMATS_MP2T_MP2T_STREAM_PARSER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 10
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "media/base/audio_decoder_config.h" 13 #include "media/base/audio_decoder_config.h"
14 #include "media/base/byte_queue.h" 14 #include "media/base/byte_queue.h"
15 #include "media/base/media_export.h" 15 #include "media/base/media_export.h"
16 #include "media/base/stream_parser.h" 16 #include "media/base/stream_parser.h"
17 #include "media/base/video_decoder_config.h" 17 #include "media/base/video_decoder_config.h"
18 #include "media/formats/mp2t/timestamp_unroller.h"
18 19
19 namespace media { 20 namespace media {
20 21
21 class StreamParserBuffer; 22 class StreamParserBuffer;
22 23
23 namespace mp2t { 24 namespace mp2t {
24 25
25 class PidState; 26 class PidState;
26 27
27 class MEDIA_EXPORT Mp2tStreamParser : public StreamParser { 28 class MEDIA_EXPORT Mp2tStreamParser : public StreamParser {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // Callback invoked by the ES stream parser 86 // Callback invoked by the ES stream parser
86 // to emit a new audio/video access unit. 87 // to emit a new audio/video access unit.
87 void OnEmitAudioBuffer( 88 void OnEmitAudioBuffer(
88 int pes_pid, 89 int pes_pid,
89 scoped_refptr<StreamParserBuffer> stream_parser_buffer); 90 scoped_refptr<StreamParserBuffer> stream_parser_buffer);
90 void OnEmitVideoBuffer( 91 void OnEmitVideoBuffer(
91 int pes_pid, 92 int pes_pid,
92 scoped_refptr<StreamParserBuffer> stream_parser_buffer); 93 scoped_refptr<StreamParserBuffer> stream_parser_buffer);
93 bool EmitRemainingBuffers(); 94 bool EmitRemainingBuffers();
94 95
96 void ApplyTimeOffset(StreamParser::BufferQueue* buffer_queue);
97
95 // List of callbacks. 98 // List of callbacks.
96 InitCB init_cb_; 99 InitCB init_cb_;
97 NewConfigCB config_cb_; 100 NewConfigCB config_cb_;
98 NewBuffersCB new_buffers_cb_; 101 NewBuffersCB new_buffers_cb_;
99 NeedKeyCB need_key_cb_; 102 NeedKeyCB need_key_cb_;
100 NewMediaSegmentCB new_segment_cb_; 103 NewMediaSegmentCB new_segment_cb_;
101 base::Closure end_of_segment_cb_; 104 base::Closure end_of_segment_cb_;
102 LogCB log_cb_; 105 LogCB log_cb_;
103 106
104 // True when AAC SBR extension is signalled in the mimetype 107 // True when AAC SBR extension is signalled in the mimetype
(...skipping 11 matching lines...) Expand all
116 int selected_video_pid_; 119 int selected_video_pid_;
117 120
118 // Pending audio & video buffers. 121 // Pending audio & video buffers.
119 std::list<BufferQueueWithConfig> buffer_queue_chain_; 122 std::list<BufferQueueWithConfig> buffer_queue_chain_;
120 123
121 // Whether |init_cb_| has been invoked. 124 // Whether |init_cb_| has been invoked.
122 bool is_initialized_; 125 bool is_initialized_;
123 126
124 // Indicate whether a segment was started. 127 // Indicate whether a segment was started.
125 bool segment_started_; 128 bool segment_started_;
129
130 // Timestamp unroller.
131 // Timestamps in PES packets must be unrolled using the same offset.
132 // So the unroller is global between PES pids.
133 TimestampUnroller timestamp_unroller_;
134
135 // The timestamp unroller might create negative timestamps,
136 // we need to add a time offset to make sure all timestamps are positive.
126 base::TimeDelta time_offset_; 137 base::TimeDelta time_offset_;
127 138
128 DISALLOW_COPY_AND_ASSIGN(Mp2tStreamParser); 139 DISALLOW_COPY_AND_ASSIGN(Mp2tStreamParser);
129 }; 140 };
130 141
131 } // namespace mp2t 142 } // namespace mp2t
132 } // namespace media 143 } // namespace media
133 144
134 #endif 145 #endif
135 146
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698