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/mp3/mp3_stream_parser.h" | 5 #include "media/formats/mp3/mp3_stream_parser.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/bit_reader.h" | 10 #include "media/base/bit_reader.h" |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 bool success = config_cb_.Run(config_, video_config, TextTrackConfigMap()); | 412 bool success = config_cb_.Run(config_, video_config, TextTrackConfigMap()); |
413 | 413 |
414 if (!init_cb_.is_null()) | 414 if (!init_cb_.is_null()) |
415 base::ResetAndReturn(&init_cb_).Run(success, kInfiniteDuration()); | 415 base::ResetAndReturn(&init_cb_).Run(success, kInfiniteDuration()); |
416 | 416 |
417 if (!success) | 417 if (!success) |
418 return -1; | 418 return -1; |
419 } | 419 } |
420 | 420 |
421 scoped_refptr<StreamParserBuffer> buffer = | 421 scoped_refptr<StreamParserBuffer> buffer = |
422 StreamParserBuffer::CopyFrom(data, frame_size, true); | 422 StreamParserBuffer::CopyFrom(data, frame_size, true, |
| 423 StreamParserBuffer::kAudio); |
423 buffer->set_timestamp(timestamp_helper_->GetTimestamp()); | 424 buffer->set_timestamp(timestamp_helper_->GetTimestamp()); |
424 buffer->set_duration(timestamp_helper_->GetFrameDuration(sample_count)); | 425 buffer->set_duration(timestamp_helper_->GetFrameDuration(sample_count)); |
425 buffers->push_back(buffer); | 426 buffers->push_back(buffer); |
426 | 427 |
427 timestamp_helper_->AddFrames(sample_count); | 428 timestamp_helper_->AddFrames(sample_count); |
428 | 429 |
429 return frame_size; | 430 return frame_size; |
430 } | 431 } |
431 | 432 |
432 static int LocateEndOfHeaders(const uint8_t* buf, int buf_len, int i) { | 433 static int LocateEndOfHeaders(const uint8_t* buf, int buf_len, int i) { |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 | 606 |
606 if (end_of_segment) { | 607 if (end_of_segment) { |
607 in_media_segment_ = false; | 608 in_media_segment_ = false; |
608 end_of_segment_cb_.Run(); | 609 end_of_segment_cb_.Run(); |
609 } | 610 } |
610 | 611 |
611 return true; | 612 return true; |
612 } | 613 } |
613 | 614 |
614 } // namespace media | 615 } // namespace media |
OLD | NEW |