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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 audio_track_id_(0), | 167 audio_track_id_(0), |
168 video_track_id_(0), | 168 video_track_id_(0), |
169 current_audio_config_(), | 169 current_audio_config_(), |
170 current_video_config_(), | 170 current_video_config_(), |
171 capture_buffers(false) { | 171 capture_buffers(false) { |
172 bool has_sbr = false; | 172 bool has_sbr = false; |
173 parser_.reset(new Mp2tStreamParser(has_sbr)); | 173 parser_.reset(new Mp2tStreamParser(has_sbr)); |
174 } | 174 } |
175 | 175 |
176 protected: | 176 protected: |
| 177 MediaLog media_log_; |
177 std::unique_ptr<Mp2tStreamParser> parser_; | 178 std::unique_ptr<Mp2tStreamParser> parser_; |
178 int segment_count_; | 179 int segment_count_; |
179 int config_count_; | 180 int config_count_; |
180 int audio_frame_count_; | 181 int audio_frame_count_; |
181 int video_frame_count_; | 182 int video_frame_count_; |
182 bool has_video_; | 183 bool has_video_; |
183 DecodeTimestamp audio_min_dts_; | 184 DecodeTimestamp audio_min_dts_; |
184 DecodeTimestamp audio_max_dts_; | 185 DecodeTimestamp audio_max_dts_; |
185 DecodeTimestamp video_min_dts_; | 186 DecodeTimestamp video_min_dts_; |
186 DecodeTimestamp video_max_dts_; | 187 DecodeTimestamp video_max_dts_; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 void InitializeParser() { | 352 void InitializeParser() { |
352 parser_->Init( | 353 parser_->Init( |
353 base::Bind(&Mp2tStreamParserTest::OnInit, base::Unretained(this)), | 354 base::Bind(&Mp2tStreamParserTest::OnInit, base::Unretained(this)), |
354 base::Bind(&Mp2tStreamParserTest::OnNewConfig, base::Unretained(this)), | 355 base::Bind(&Mp2tStreamParserTest::OnNewConfig, base::Unretained(this)), |
355 base::Bind(&Mp2tStreamParserTest::OnNewBuffers, base::Unretained(this)), | 356 base::Bind(&Mp2tStreamParserTest::OnNewBuffers, base::Unretained(this)), |
356 true, | 357 true, |
357 base::Bind(&Mp2tStreamParserTest::OnKeyNeeded, base::Unretained(this)), | 358 base::Bind(&Mp2tStreamParserTest::OnKeyNeeded, base::Unretained(this)), |
358 base::Bind(&Mp2tStreamParserTest::OnNewSegment, base::Unretained(this)), | 359 base::Bind(&Mp2tStreamParserTest::OnNewSegment, base::Unretained(this)), |
359 base::Bind(&Mp2tStreamParserTest::OnEndOfSegment, | 360 base::Bind(&Mp2tStreamParserTest::OnEndOfSegment, |
360 base::Unretained(this)), | 361 base::Unretained(this)), |
361 new MediaLog()); | 362 &media_log_); |
362 } | 363 } |
363 | 364 |
364 bool ParseMpeg2TsFile(const std::string& filename, int append_bytes) { | 365 bool ParseMpeg2TsFile(const std::string& filename, int append_bytes) { |
365 scoped_refptr<DecoderBuffer> buffer = ReadTestDataFile(filename); | 366 scoped_refptr<DecoderBuffer> buffer = ReadTestDataFile(filename); |
366 EXPECT_TRUE(AppendDataInPieces(buffer->data(), | 367 EXPECT_TRUE(AppendDataInPieces(buffer->data(), |
367 buffer->data_size(), | 368 buffer->data_size(), |
368 append_bytes)); | 369 append_bytes)); |
369 return true; | 370 return true; |
370 } | 371 } |
371 }; | 372 }; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 const auto& buffer = audio_buffer_capture_[i]; | 501 const auto& buffer = audio_buffer_capture_[i]; |
501 std::string unencrypted_audio_buffer( | 502 std::string unencrypted_audio_buffer( |
502 reinterpret_cast<const char*>(buffer->data()), buffer->data_size()); | 503 reinterpret_cast<const char*>(buffer->data()), buffer->data_size()); |
503 EXPECT_EQ(decrypted_audio_buffers[i], unencrypted_audio_buffer); | 504 EXPECT_EQ(decrypted_audio_buffers[i], unencrypted_audio_buffer); |
504 } | 505 } |
505 } | 506 } |
506 #endif | 507 #endif |
507 | 508 |
508 } // namespace mp2t | 509 } // namespace mp2t |
509 } // namespace media | 510 } // namespace media |
OLD | NEW |