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

Side by Side Diff: media/formats/webm/webm_stream_parser.cc

Issue 1041353002: media-internals: Differentiate error, info, and debug log messages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address reviewer comments Created 5 years, 8 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 #include "media/formats/webm/webm_stream_parser.h" 5 #include "media/formats/webm/webm_stream_parser.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // TODO(matthewjheaney): Implement support for chapters. 148 // TODO(matthewjheaney): Implement support for chapters.
149 if (cur_size < (result + element_size)) { 149 if (cur_size < (result + element_size)) {
150 // We don't have the whole element yet. Signal we need more data. 150 // We don't have the whole element yet. Signal we need more data.
151 return 0; 151 return 0;
152 } 152 }
153 // Skip the element. 153 // Skip the element.
154 return result + element_size; 154 return result + element_size;
155 break; 155 break;
156 case kWebMIdCluster: 156 case kWebMIdCluster:
157 if (!cluster_parser_) { 157 if (!cluster_parser_) {
158 MEDIA_LOG(log_cb_) << "Found Cluster element before Info."; 158 MEDIA_LOG(ERROR, log_cb_) << "Found Cluster element before Info.";
159 return -1; 159 return -1;
160 } 160 }
161 ChangeState(kParsingClusters); 161 ChangeState(kParsingClusters);
162 new_segment_cb_.Run(); 162 new_segment_cb_.Run();
163 return 0; 163 return 0;
164 break; 164 break;
165 case kWebMIdSegment: 165 case kWebMIdSegment:
166 // Segment of unknown size indicates live stream. 166 // Segment of unknown size indicates live stream.
167 if (element_size == kWebMUnknownSize) 167 if (element_size == kWebMUnknownSize)
168 unknown_segment_size_ = true; 168 unknown_segment_size_ = true;
169 // Just consume the segment header. 169 // Just consume the segment header.
170 return result; 170 return result;
171 break; 171 break;
172 case kWebMIdInfo: 172 case kWebMIdInfo:
173 // We've found the element we are looking for. 173 // We've found the element we are looking for.
174 break; 174 break;
175 default: { 175 default: {
176 MEDIA_LOG(log_cb_) << "Unexpected element ID 0x" << std::hex << id; 176 MEDIA_LOG(ERROR, log_cb_) << "Unexpected element ID 0x" << std::hex << id;
177 return -1; 177 return -1;
178 } 178 }
179 } 179 }
180 180
181 WebMInfoParser info_parser; 181 WebMInfoParser info_parser;
182 result = info_parser.Parse(cur, cur_size); 182 result = info_parser.Parse(cur, cur_size);
183 183
184 if (result <= 0) 184 if (result <= 0)
185 return result; 185 return result;
186 186
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 276
277 return bytes_parsed; 277 return bytes_parsed;
278 } 278 }
279 279
280 void WebMStreamParser::OnEncryptedMediaInitData(const std::string& key_id) { 280 void WebMStreamParser::OnEncryptedMediaInitData(const std::string& key_id) {
281 std::vector<uint8> key_id_vector(key_id.begin(), key_id.end()); 281 std::vector<uint8> key_id_vector(key_id.begin(), key_id.end());
282 encrypted_media_init_data_cb_.Run(kWebMInitDataType, key_id_vector); 282 encrypted_media_init_data_cb_.Run(kWebMInitDataType, key_id_vector);
283 } 283 }
284 284
285 } // namespace media 285 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698