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

Side by Side Diff: media/base/stream_parser.h

Issue 2254093002: Return buffers from StreamParsers in a single unified map (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restored calling GetBuffers after each Parse in WebM test Created 4 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
« no previous file with comments | « no previous file | media/base/stream_parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_BASE_STREAM_PARSER_H_ 5 #ifndef MEDIA_BASE_STREAM_PARSER_H_
6 #define MEDIA_BASE_STREAM_PARSER_H_ 6 #define MEDIA_BASE_STREAM_PARSER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 21 matching lines...) Expand all
32 // Abstract interface for parsing media byte streams. 32 // Abstract interface for parsing media byte streams.
33 class MEDIA_EXPORT StreamParser { 33 class MEDIA_EXPORT StreamParser {
34 public: 34 public:
35 using BufferQueue = std::deque<scoped_refptr<StreamParserBuffer>>; 35 using BufferQueue = std::deque<scoped_refptr<StreamParserBuffer>>;
36 36
37 // Range of |TrackId| is dependent upon stream parsers. It is currently 37 // Range of |TrackId| is dependent upon stream parsers. It is currently
38 // the key for the buffer's text track config in the applicable 38 // the key for the buffer's text track config in the applicable
39 // TextTrackConfigMap (which is passed in StreamParser::NewConfigCB), or 39 // TextTrackConfigMap (which is passed in StreamParser::NewConfigCB), or
40 // 0 for other media types that currently allow at most one track. 40 // 0 for other media types that currently allow at most one track.
41 // WebMTracksParser uses -1 as an invalid text track number. 41 // WebMTracksParser uses -1 as an invalid text track number.
42 // TODO(wolenetz/acolwell): Change to size_type while fixing stream parsers to 42 // It is also the key for BufferQueueMap structure returned by stream parsers.
43 // emit validated track configuration and buffer vectors rather than max 1 43 // TODO(servolk/wolenetz): Change to size_type or unsigned after fixing track
44 // audio, max 1 video, and N text tracks in a map keyed by 44 // id handling in FrameProcessor.
45 // bytestream-specific-ranged track numbers. See http://crbug.com/341581.
46 typedef int TrackId; 45 typedef int TrackId;
47 46
48 // Map of text track ID to the track configuration. 47 // Map of text track ID to the track configuration.
49 typedef std::map<TrackId, TextTrackConfig> TextTrackConfigMap; 48 typedef std::map<TrackId, TextTrackConfig> TextTrackConfigMap;
50 49
51 // Map of text track ID to decode-timestamp-ordered buffers for the track. 50 // Map of track ID to decode-timestamp-ordered buffers for the track.
52 typedef std::map<TrackId, const BufferQueue> TextBufferQueueMap; 51 using BufferQueueMap = std::map<TrackId, BufferQueue>;
53 52
54 // Stream parameters passed in InitCB. 53 // Stream parameters passed in InitCB.
55 struct MEDIA_EXPORT InitParameters { 54 struct MEDIA_EXPORT InitParameters {
56 InitParameters(base::TimeDelta duration); 55 InitParameters(base::TimeDelta duration);
57 56
58 // Stream duration. 57 // Stream duration.
59 base::TimeDelta duration; 58 base::TimeDelta duration;
60 59
61 // Indicates the source time associated with presentation timestamp 0. A 60 // Indicates the source time associated with presentation timestamp 0. A
62 // null Time is returned if no mapping to Time exists. 61 // null Time is returned if no mapping to Time exists.
(...skipping 24 matching lines...) Expand all
87 // Second parameter - The new text tracks configuration. If the map is empty, 86 // Second parameter - The new text tracks configuration. If the map is empty,
88 // then no text tracks were parsed for use from the stream. 87 // then no text tracks were parsed for use from the stream.
89 // Return value - True if the new configurations are accepted. 88 // Return value - True if the new configurations are accepted.
90 // False if the new configurations are not supported 89 // False if the new configurations are not supported
91 // and indicates that a parsing error should be signalled. 90 // and indicates that a parsing error should be signalled.
92 typedef base::Callback<bool(std::unique_ptr<MediaTracks>, 91 typedef base::Callback<bool(std::unique_ptr<MediaTracks>,
93 const TextTrackConfigMap&)> 92 const TextTrackConfigMap&)>
94 NewConfigCB; 93 NewConfigCB;
95 94
96 // New stream buffers have been parsed. 95 // New stream buffers have been parsed.
97 // First parameter - A queue of newly parsed audio buffers. 96 // First parameter - A map of track ids to queues of newly parsed buffers.
98 // Second parameter - A queue of newly parsed video buffers.
99 // Third parameter - A map of text track ids to queues of newly parsed inband
100 // text buffers. If the map is not empty, it must contain
101 // at least one track with a non-empty queue of text
102 // buffers.
103 // Return value - True indicates that the buffers are accepted. 97 // Return value - True indicates that the buffers are accepted.
104 // False if something was wrong with the buffers and a parsing 98 // False if something was wrong with the buffers and a parsing
105 // error should be signalled. 99 // error should be signalled.
106 typedef base::Callback<bool(const BufferQueue&, 100 typedef base::Callback<bool(const BufferQueueMap&)> NewBuffersCB;
107 const BufferQueue&,
108 const TextBufferQueueMap&)> NewBuffersCB;
109 101
110 // Signals the beginning of a new media segment. 102 // Signals the beginning of a new media segment.
111 typedef base::Callback<void()> NewMediaSegmentCB; 103 typedef base::Callback<void()> NewMediaSegmentCB;
112 104
113 // Signals the end of a media segment. 105 // Signals the end of a media segment.
114 typedef base::Callback<void()> EndMediaSegmentCB; 106 typedef base::Callback<void()> EndMediaSegmentCB;
115 107
116 // A new potentially encrypted stream has been parsed. 108 // A new potentially encrypted stream has been parsed.
117 // First parameter - The type of the initialization data associated with the 109 // First parameter - The type of the initialization data associated with the
118 // stream. 110 // stream.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // Any previous contents of |merged_buffers| is assumed to have lower 149 // Any previous contents of |merged_buffers| is assumed to have lower
158 // decode timestamps versus the provided buffers. All provided buffer queues 150 // decode timestamps versus the provided buffers. All provided buffer queues
159 // are assumed to already be in decode-timestamp order. 151 // are assumed to already be in decode-timestamp order.
160 // Returns false if any of the provided audio/video/text buffers are found 152 // Returns false if any of the provided audio/video/text buffers are found
161 // to not be in decode timestamp order, or have a decode timestamp less than 153 // to not be in decode timestamp order, or have a decode timestamp less than
162 // the last buffer, if any, in |merged_buffers|. Partial results may exist 154 // the last buffer, if any, in |merged_buffers|. Partial results may exist
163 // in |merged_buffers| in this case. Returns true on success. 155 // in |merged_buffers| in this case. Returns true on success.
164 // No validation of media type within the various buffer queues is done here. 156 // No validation of media type within the various buffer queues is done here.
165 // TODO(wolenetz/acolwell): Merge incrementally in parsers to eliminate 157 // TODO(wolenetz/acolwell): Merge incrementally in parsers to eliminate
166 // subtle issues with tie-breaking. See http://crbug.com/338484. 158 // subtle issues with tie-breaking. See http://crbug.com/338484.
167 MEDIA_EXPORT bool MergeBufferQueues( 159 MEDIA_EXPORT bool MergeBufferQueues(const StreamParser::BufferQueueMap& buffers,
168 const StreamParser::BufferQueue& audio_buffers, 160 StreamParser::BufferQueue* merged_buffers);
169 const StreamParser::BufferQueue& video_buffers,
170 const StreamParser::TextBufferQueueMap& text_buffers,
171 StreamParser::BufferQueue* merged_buffers);
172 161
173 } // namespace media 162 } // namespace media
174 163
175 #endif // MEDIA_BASE_STREAM_PARSER_H_ 164 #endif // MEDIA_BASE_STREAM_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/stream_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698