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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 VideoDecoderConfig video_config; | 411 VideoDecoderConfig video_config; |
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 // TODO(wolenetz/acolwell): Validate and use a common cross-parser TrackId |
| 422 // type and allow multiple audio tracks, if applicable. See |
| 423 // https://crbug.com/341581. |
421 scoped_refptr<StreamParserBuffer> buffer = | 424 scoped_refptr<StreamParserBuffer> buffer = |
422 StreamParserBuffer::CopyFrom(data, frame_size, true); | 425 StreamParserBuffer::CopyFrom(data, frame_size, true, |
| 426 DemuxerStream::AUDIO, 0); |
423 buffer->set_timestamp(timestamp_helper_->GetTimestamp()); | 427 buffer->set_timestamp(timestamp_helper_->GetTimestamp()); |
424 buffer->set_duration(timestamp_helper_->GetFrameDuration(sample_count)); | 428 buffer->set_duration(timestamp_helper_->GetFrameDuration(sample_count)); |
425 buffers->push_back(buffer); | 429 buffers->push_back(buffer); |
426 | 430 |
427 timestamp_helper_->AddFrames(sample_count); | 431 timestamp_helper_->AddFrames(sample_count); |
428 | 432 |
429 return frame_size; | 433 return frame_size; |
430 } | 434 } |
431 | 435 |
432 static int LocateEndOfHeaders(const uint8_t* buf, int buf_len, int i) { | 436 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 | 609 |
606 if (end_of_segment) { | 610 if (end_of_segment) { |
607 in_media_segment_ = false; | 611 in_media_segment_ = false; |
608 end_of_segment_cb_.Run(); | 612 end_of_segment_cb_.Run(); |
609 } | 613 } |
610 | 614 |
611 return true; | 615 return true; |
612 } | 616 } |
613 | 617 |
614 } // namespace media | 618 } // namespace media |
OLD | NEW |