| 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/mp2t/mp2t_stream_parser.h" | 5 #include "media/formats/mp2t/mp2t_stream_parser.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 return true; | 537 return true; |
| 538 | 538 |
| 539 // Pass the config before invoking the initialization callback. | 539 // Pass the config before invoking the initialization callback. |
| 540 scoped_ptr<MediaTracks> media_tracks = GenerateMediaTrackInfo( | 540 scoped_ptr<MediaTracks> media_tracks = GenerateMediaTrackInfo( |
| 541 queue_with_config.audio_config, queue_with_config.video_config); | 541 queue_with_config.audio_config, queue_with_config.video_config); |
| 542 RCHECK(config_cb_.Run(std::move(media_tracks), TextTrackConfigMap())); | 542 RCHECK(config_cb_.Run(std::move(media_tracks), TextTrackConfigMap())); |
| 543 queue_with_config.is_config_sent = true; | 543 queue_with_config.is_config_sent = true; |
| 544 | 544 |
| 545 // For Mpeg2 TS, the duration is not known. | 545 // For Mpeg2 TS, the duration is not known. |
| 546 DVLOG(1) << "Mpeg2TS stream parser initialization done"; | 546 DVLOG(1) << "Mpeg2TS stream parser initialization done"; |
| 547 base::ResetAndReturn(&init_cb_).Run(InitParameters(kInfiniteDuration())); | 547 |
| 548 // TODO(wolenetz): If possible, detect and report track counts by type more |
| 549 // accurately here. Currently, capped at max 1 each for audio and video, with |
| 550 // assumption of 0 text tracks. |
| 551 InitParameters params(kInfiniteDuration()); |
| 552 params.detected_audio_track_count = |
| 553 queue_with_config.audio_config.IsValidConfig() ? 1 : 0; |
| 554 params.detected_video_track_count = |
| 555 queue_with_config.video_config.IsValidConfig() ? 1 : 0; |
| 556 base::ResetAndReturn(&init_cb_).Run(params); |
| 548 is_initialized_ = true; | 557 is_initialized_ = true; |
| 549 | 558 |
| 550 return true; | 559 return true; |
| 551 } | 560 } |
| 552 | 561 |
| 553 void Mp2tStreamParser::OnEmitAudioBuffer( | 562 void Mp2tStreamParser::OnEmitAudioBuffer( |
| 554 int pes_pid, | 563 int pes_pid, |
| 555 scoped_refptr<StreamParserBuffer> stream_parser_buffer) { | 564 scoped_refptr<StreamParserBuffer> stream_parser_buffer) { |
| 556 DCHECK_EQ(pes_pid, selected_audio_pid_); | 565 DCHECK_EQ(pes_pid, selected_audio_pid_); |
| 557 | 566 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 // so that buffers with the same config can be added later on. | 670 // so that buffers with the same config can be added later on. |
| 662 BufferQueueWithConfig queue_with_config( | 671 BufferQueueWithConfig queue_with_config( |
| 663 true, last_audio_config, last_video_config); | 672 true, last_audio_config, last_video_config); |
| 664 buffer_queue_chain_.push_back(queue_with_config); | 673 buffer_queue_chain_.push_back(queue_with_config); |
| 665 | 674 |
| 666 return true; | 675 return true; |
| 667 } | 676 } |
| 668 | 677 |
| 669 } // namespace mp2t | 678 } // namespace mp2t |
| 670 } // namespace media | 679 } // namespace media |
| OLD | NEW |