| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" |
| 8 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 10 #include "media/base/audio_decoder_config.h" | 11 #include "media/base/audio_decoder_config.h" |
| 11 #include "media/base/buffers.h" | 12 #include "media/base/buffers.h" |
| 12 #include "media/base/stream_parser_buffer.h" | 13 #include "media/base/stream_parser_buffer.h" |
| 13 #include "media/base/text_track_config.h" | 14 #include "media/base/text_track_config.h" |
| 14 #include "media/base/video_decoder_config.h" | 15 #include "media/base/video_decoder_config.h" |
| 15 #include "media/formats/mp2t/es_parser.h" | 16 #include "media/formats/mp2t/es_parser.h" |
| 16 #include "media/formats/mp2t/es_parser_adts.h" | 17 #include "media/formats/mp2t/es_parser_adts.h" |
| 17 #include "media/formats/mp2t/es_parser_h264.h" | 18 #include "media/formats/mp2t/es_parser_h264.h" |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 return true; | 478 return true; |
| 478 | 479 |
| 479 // Pass the config before invoking the initialization callback. | 480 // Pass the config before invoking the initialization callback. |
| 480 RCHECK(config_cb_.Run(queue_with_config.audio_config, | 481 RCHECK(config_cb_.Run(queue_with_config.audio_config, |
| 481 queue_with_config.video_config, | 482 queue_with_config.video_config, |
| 482 TextTrackConfigMap())); | 483 TextTrackConfigMap())); |
| 483 queue_with_config.is_config_sent = true; | 484 queue_with_config.is_config_sent = true; |
| 484 | 485 |
| 485 // For Mpeg2 TS, the duration is not known. | 486 // For Mpeg2 TS, the duration is not known. |
| 486 DVLOG(1) << "Mpeg2TS stream parser initialization done"; | 487 DVLOG(1) << "Mpeg2TS stream parser initialization done"; |
| 487 init_cb_.Run(true, kInfiniteDuration(), false); | 488 base::ResetAndReturn(&init_cb_).Run( |
| 489 true, kInfiniteDuration(), base::Time(), false); |
| 488 is_initialized_ = true; | 490 is_initialized_ = true; |
| 489 | 491 |
| 490 return true; | 492 return true; |
| 491 } | 493 } |
| 492 | 494 |
| 493 void Mp2tStreamParser::OnEmitAudioBuffer( | 495 void Mp2tStreamParser::OnEmitAudioBuffer( |
| 494 int pes_pid, | 496 int pes_pid, |
| 495 scoped_refptr<StreamParserBuffer> stream_parser_buffer) { | 497 scoped_refptr<StreamParserBuffer> stream_parser_buffer) { |
| 496 DCHECK_EQ(pes_pid, selected_audio_pid_); | 498 DCHECK_EQ(pes_pid, selected_audio_pid_); |
| 497 | 499 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 // so that buffers with the same config can be added later on. | 614 // so that buffers with the same config can be added later on. |
| 613 BufferQueueWithConfig queue_with_config( | 615 BufferQueueWithConfig queue_with_config( |
| 614 true, last_audio_config, last_video_config); | 616 true, last_audio_config, last_video_config); |
| 615 buffer_queue_chain_.push_back(queue_with_config); | 617 buffer_queue_chain_.push_back(queue_with_config); |
| 616 | 618 |
| 617 return true; | 619 return true; |
| 618 } | 620 } |
| 619 | 621 |
| 620 } // namespace mp2t | 622 } // namespace mp2t |
| 621 } // namespace media | 623 } // namespace media |
| 622 | |
| OLD | NEW |