OLD | NEW |
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/mpeg/mpeg_audio_stream_parser_base.h" | 5 #include "media/formats/mpeg/mpeg_audio_stream_parser_base.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "media/base/buffers.h" | 10 #include "media/base/buffers.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 if (size < 4) | 255 if (size < 4) |
256 return 0; | 256 return 0; |
257 | 257 |
258 if (memcmp("ICY ", data, 4)) | 258 if (memcmp("ICY ", data, 4)) |
259 return -1; | 259 return -1; |
260 | 260 |
261 int locate_size = std::min(size, kMaxIcecastHeaderSize); | 261 int locate_size = std::min(size, kMaxIcecastHeaderSize); |
262 int offset = LocateEndOfHeaders(data, locate_size, 4); | 262 int offset = LocateEndOfHeaders(data, locate_size, 4); |
263 if (offset < 0) { | 263 if (offset < 0) { |
264 if (locate_size == kMaxIcecastHeaderSize) { | 264 if (locate_size == kMaxIcecastHeaderSize) { |
265 MEDIA_LOG(log_cb_) << "Icecast header is too large."; | 265 MEDIA_LOG(ERROR, log_cb_) << "Icecast header is too large."; |
266 return -1; | 266 return -1; |
267 } | 267 } |
268 | 268 |
269 return 0; | 269 return 0; |
270 } | 270 } |
271 | 271 |
272 return offset; | 272 return offset; |
273 } | 273 } |
274 | 274 |
275 int MPEGAudioStreamParserBase::ParseID3v1(const uint8* data, int size) { | 275 int MPEGAudioStreamParserBase::ParseID3v1(const uint8* data, int size) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 // expose it as a metadata text track. | 316 // expose it as a metadata text track. |
317 return actual_tag_size; | 317 return actual_tag_size; |
318 } | 318 } |
319 | 319 |
320 bool MPEGAudioStreamParserBase::ParseSyncSafeInt(BitReader* reader, | 320 bool MPEGAudioStreamParserBase::ParseSyncSafeInt(BitReader* reader, |
321 int32* value) { | 321 int32* value) { |
322 *value = 0; | 322 *value = 0; |
323 for (int i = 0; i < 4; ++i) { | 323 for (int i = 0; i < 4; ++i) { |
324 uint8 tmp; | 324 uint8 tmp; |
325 if (!reader->ReadBits(1, &tmp) || tmp != 0) { | 325 if (!reader->ReadBits(1, &tmp) || tmp != 0) { |
326 MEDIA_LOG(log_cb_) << "ID3 syncsafe integer byte MSb is not 0!"; | 326 MEDIA_LOG(ERROR, log_cb_) << "ID3 syncsafe integer byte MSb is not 0!"; |
327 return false; | 327 return false; |
328 } | 328 } |
329 | 329 |
330 if (!reader->ReadBits(7, &tmp)) | 330 if (!reader->ReadBits(7, &tmp)) |
331 return false; | 331 return false; |
332 | 332 |
333 *value <<= 7; | 333 *value <<= 7; |
334 *value += tmp; | 334 *value += tmp; |
335 } | 335 } |
336 | 336 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 if (end_of_segment) { | 411 if (end_of_segment) { |
412 in_media_segment_ = false; | 412 in_media_segment_ = false; |
413 end_of_segment_cb_.Run(); | 413 end_of_segment_cb_.Run(); |
414 } | 414 } |
415 | 415 |
416 timestamp_helper_->SetBaseTimestamp(base::TimeDelta()); | 416 timestamp_helper_->SetBaseTimestamp(base::TimeDelta()); |
417 return true; | 417 return true; |
418 } | 418 } |
419 | 419 |
420 } // namespace media | 420 } // namespace media |
OLD | NEW |