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

Unified Diff: media/formats/webm/webm_cluster_parser.cc

Issue 143973009: SourceState: Coalesce OnNewBuffers() CB to include OnTextBuffers() behavior (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address PS2 comments Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/formats/webm/webm_cluster_parser.h ('k') | media/formats/webm/webm_cluster_parser_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/formats/webm/webm_cluster_parser.cc
diff --git a/media/formats/webm/webm_cluster_parser.cc b/media/formats/webm/webm_cluster_parser.cc
index e662f835d3cd7d9d253ceffeeaf491951b96fa41..67e6d82576c9755e1b4a995da25645f8f8e7cc37 100644
--- a/media/formats/webm/webm_cluster_parser.cc
+++ b/media/formats/webm/webm_cluster_parser.cc
@@ -17,38 +17,6 @@
namespace media {
-WebMClusterParser::TextTrackIterator::TextTrackIterator(
- const TextTrackMap& text_track_map) :
- iterator_(text_track_map.begin()),
- iterator_end_(text_track_map.end()) {
-}
-
-WebMClusterParser::TextTrackIterator::TextTrackIterator(
- const TextTrackIterator& rhs) :
- iterator_(rhs.iterator_),
- iterator_end_(rhs.iterator_end_) {
-}
-
-WebMClusterParser::TextTrackIterator::~TextTrackIterator() {
-}
-
-bool WebMClusterParser::TextTrackIterator::operator()(
- int* track_num,
- const BufferQueue** buffers) {
- if (iterator_ == iterator_end_) {
- *track_num = 0;
- *buffers = NULL;
-
- return false;
- }
-
- *track_num = iterator_->first;
- *buffers = &iterator_->second.buffers();
-
- ++iterator_;
- return true;
-}
-
WebMClusterParser::WebMClusterParser(
int64 timecode_scale, int audio_track_num, int video_track_num,
const WebMTracksParser::TextTracks& text_tracks,
@@ -131,9 +99,20 @@ int WebMClusterParser::Parse(const uint8* buf, int size) {
return result;
}
-WebMClusterParser::TextTrackIterator
-WebMClusterParser::CreateTextTrackIterator() const {
- return TextTrackIterator(text_track_map_);
+const WebMClusterParser::TextBufferQueueMap&
+WebMClusterParser::GetTextBuffers() {
+ // Translate our |text_track_map_| into |text_buffers_map_|, inserting rows in
+ // the output only for non-empty text buffer queues in |text_track_map_|.
+ text_buffers_map_.clear();
+ for (TextTrackMap::const_iterator itr = text_track_map_.begin();
+ itr != text_track_map_.end();
+ ++itr) {
+ const BufferQueue& text_buffers = itr->second.buffers();
+ if (!text_buffers.empty())
+ text_buffers_map_.insert(std::make_pair(itr->first, text_buffers));
+ }
+
+ return text_buffers_map_;
}
WebMParserClient* WebMClusterParser::OnListStart(int id) {
@@ -451,6 +430,7 @@ bool WebMClusterParser::Track::IsKeyframe(const uint8* data, int size) const {
}
void WebMClusterParser::ResetTextTracks() {
+ text_buffers_map_.clear();
for (TextTrackMap::iterator it = text_track_map_.begin();
it != text_track_map_.end();
++it) {
« no previous file with comments | « media/formats/webm/webm_cluster_parser.h ('k') | media/formats/webm/webm_cluster_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698