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

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

Issue 2254093002: Return buffers from StreamParsers in a single unified map (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 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 (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 #include "media/base/stream_parser.h" 5 #include "media/base/stream_parser.h"
6 6
7 #include "media/base/stream_parser_buffer.h" 7 #include "media/base/stream_parser_buffer.h"
8 8
9 namespace media { 9 namespace media {
10 10
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // the last buffer in |merged_buffers|, advance the corresponding 104 // the last buffer in |merged_buffers|, advance the corresponding
105 // input BufferQueue iterator, and continue. 105 // input BufferQueue iterator, and continue.
106 scoped_refptr<StreamParserBuffer> buffer = 106 scoped_refptr<StreamParserBuffer> buffer =
107 *itrs[index_of_queue_with_next_decode_timestamp]; 107 *itrs[index_of_queue_with_next_decode_timestamp];
108 last_decode_timestamp = buffer->GetDecodeTimestamp(); 108 last_decode_timestamp = buffer->GetDecodeTimestamp();
109 merged_buffers->push_back(buffer); 109 merged_buffers->push_back(buffer);
110 ++itrs[index_of_queue_with_next_decode_timestamp]; 110 ++itrs[index_of_queue_with_next_decode_timestamp];
111 } 111 }
112 } 112 }
113 113
114 bool MergeBufferQueues(const StreamParser::BufferQueue& audio_buffers, 114 bool MergeBufferQueues(const StreamParser::BufferQueueMap& buffer_queue_map,
115 const StreamParser::BufferQueue& video_buffers,
116 const StreamParser::TextBufferQueueMap& text_buffers,
117 StreamParser::BufferQueue* merged_buffers) { 115 StreamParser::BufferQueue* merged_buffers) {
118 DCHECK(merged_buffers); 116 DCHECK(merged_buffers);
119 117
120 // Prepare vector containing pointers to any provided non-empty buffer queues. 118 // Prepare vector containing pointers to any provided non-empty buffer queues.
119
120 // Append audio buffer queues first, before all other types, since
121 // FrameProcessorTest.AudioVideo_Discontinuity currently depends on audio
122 // buffers being processed first.
121 std::vector<const StreamParser::BufferQueue*> buffer_queues; 123 std::vector<const StreamParser::BufferQueue*> buffer_queues;
DaleCurtis 2016/08/19 01:06:25 Isn't there an insert() method that can do this wi
servolk 2016/08/19 01:37:31 Do you mean something like std::copy_if or somethi
122 if (!audio_buffers.empty()) 124 for (const auto& it : buffer_queue_map) {
123 buffer_queues.push_back(&audio_buffers); 125 DCHECK(!it.second.empty());
124 if (!video_buffers.empty()) 126 if (it.second[0]->type() == DemuxerStream::AUDIO)
125 buffer_queues.push_back(&video_buffers); 127 buffer_queues.push_back(&it.second);
126 for (StreamParser::TextBufferQueueMap::const_iterator map_itr = 128 }
127 text_buffers.begin(); 129 for (const auto& it : buffer_queue_map) {
128 map_itr != text_buffers.end(); 130 DCHECK(!it.second.empty());
129 map_itr++) { 131 if (it.second[0]->type() != DemuxerStream::AUDIO)
130 if (!map_itr->second.empty()) 132 buffer_queues.push_back(&it.second);
131 buffer_queues.push_back(&(map_itr->second));
132 } 133 }
133 134
134 // Do the merge. 135 // Do the merge.
135 return MergeBufferQueuesInternal(buffer_queues, merged_buffers); 136 return MergeBufferQueuesInternal(buffer_queues, merged_buffers);
136 } 137 }
137 138
138 } // namespace media 139 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698