Chromium Code Reviews| Index: media/webm/webm_stream_parser.cc |
| diff --git a/media/webm/webm_stream_parser.cc b/media/webm/webm_stream_parser.cc |
| index 12be44926842e3d0bd09abc082cd4d9b0adf2830..f7acec8e3b522a66d684907271228e107fdc0805 100644 |
| --- a/media/webm/webm_stream_parser.cc |
| +++ b/media/webm/webm_stream_parser.cc |
| @@ -8,7 +8,6 @@ |
| #include "base/callback.h" |
| #include "base/logging.h" |
| -#include "base/stl_util.h" |
| #include "media/webm/webm_cluster_parser.h" |
| #include "media/webm/webm_constants.h" |
| #include "media/webm/webm_content_encodings.h" |
| @@ -24,7 +23,6 @@ WebMStreamParser::WebMStreamParser() |
| } |
| WebMStreamParser::~WebMStreamParser() { |
| - STLDeleteValues(&text_track_map_); |
| } |
| void WebMStreamParser::Init(const InitCB& init_cb, |
| @@ -32,7 +30,6 @@ void WebMStreamParser::Init(const InitCB& init_cb, |
| const NewBuffersCB& new_buffers_cb, |
| const NewTextBuffersCB& text_cb, |
| const NeedKeyCB& need_key_cb, |
| - const AddTextTrackCB& add_text_track_cb, |
| const NewMediaSegmentCB& new_segment_cb, |
| const base::Closure& end_of_segment_cb, |
| const LogCB& log_cb) { |
| @@ -41,7 +38,6 @@ void WebMStreamParser::Init(const InitCB& init_cb, |
| DCHECK(!init_cb.is_null()); |
| DCHECK(!config_cb.is_null()); |
| DCHECK(!new_buffers_cb.is_null()); |
| - DCHECK(!text_cb.is_null()); |
| DCHECK(!need_key_cb.is_null()); |
| DCHECK(!new_segment_cb.is_null()); |
| DCHECK(!end_of_segment_cb.is_null()); |
| @@ -52,7 +48,6 @@ void WebMStreamParser::Init(const InitCB& init_cb, |
| new_buffers_cb_ = new_buffers_cb; |
| text_cb_ = text_cb; |
| need_key_cb_ = need_key_cb; |
| - add_text_track_cb_ = add_text_track_cb; |
| new_segment_cb_ = new_segment_cb; |
| end_of_segment_cb_ = end_of_segment_cb; |
| log_cb_ = log_cb; |
| @@ -175,7 +170,7 @@ int WebMStreamParser::ParseInfoAndTracks(const uint8* data, int size) { |
| cur_size -= result; |
| bytes_parsed += result; |
| - WebMTracksParser tracks_parser(log_cb_, add_text_track_cb_.is_null()); |
| + WebMTracksParser tracks_parser(log_cb_, text_cb_.is_null()); |
| result = tracks_parser.Parse(cur, cur_size); |
| if (result <= 0) |
| @@ -199,10 +194,7 @@ int WebMStreamParser::ParseInfoAndTracks(const uint8* data, int size) { |
| if (video_config.is_encrypted()) |
| FireNeedKey(tracks_parser.video_encryption_key_id()); |
| - if (!config_cb_.Run(audio_config, video_config)) { |
| - DVLOG(1) << "New config data isn't allowed."; |
| - return -1; |
| - } |
| + TextTrackConfigMap text_track_config_map; |
| typedef WebMTracksParser::TextTracks TextTracks; |
| const TextTracks& text_tracks = tracks_parser.text_tracks(); |
| @@ -212,17 +204,17 @@ int WebMStreamParser::ParseInfoAndTracks(const uint8* data, int size) { |
| const WebMTracksParser::TextTrackInfo& text_track_info = itr->second; |
| // TODO(matthewjheaney): verify that WebVTT uses ISO 639-2 for lang |
| - scoped_ptr<TextTrack> text_track = |
| - add_text_track_cb_.Run(text_track_info.kind, |
| - text_track_info.name, |
| - text_track_info.language); |
| - // Assume ownership of pointer, and cache the text track object, for use |
| - // later when we have text track buffers. (The text track objects are |
| - // deallocated in the dtor for this class.) |
| + text_track_config_map.insert( |
| + std::make_pair(itr->first, |
| + TextTrackConfig(text_track_info.kind, |
|
acolwell GONE FROM CHROMIUM
2013/10/29 21:14:19
It looks like TextTrackInfo is equivalent to TextT
Matthew Heaney (Chromium)
2013/11/05 04:52:40
Done.
|
| + text_track_info.name, |
| + text_track_info.language))); |
| + } |
| - if (text_track) |
| - text_track_map_.insert(std::make_pair(itr->first, text_track.release())); |
| + if (!config_cb_.Run(audio_config, video_config, text_track_config_map)) { |
| + DVLOG(1) << "New config data isn't allowed."; |
| + return -1; |
| } |
| cluster_parser_.reset(new WebMClusterParser( |
| @@ -301,14 +293,7 @@ int WebMStreamParser::ParseCluster(const uint8* data, int size) { |
| const BufferQueue* text_buffers; |
| while (text_track_iter(&text_track_num, &text_buffers)) { |
| - TextTrackMap::iterator find_result = text_track_map_.find(text_track_num); |
| - |
| - if (find_result == text_track_map_.end()) |
| - continue; |
| - |
| - TextTrack* const text_track = find_result->second; |
| - |
| - if (!text_buffers->empty() && !text_cb_.Run(text_track, *text_buffers)) |
| + if (!text_buffers->empty() && !text_cb_.Run(text_track_num, *text_buffers)) |
| return -1; |
| } |