| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 DVLOG(1) << "OnNewSegment"; | 179 DVLOG(1) << "OnNewSegment"; |
| 180 segment_count_++; | 180 segment_count_++; |
| 181 } | 181 } |
| 182 | 182 |
| 183 void OnEndOfSegment() { | 183 void OnEndOfSegment() { |
| 184 NOTREACHED() << "OnEndOfSegment not expected in the Mpeg2 TS parser"; | 184 NOTREACHED() << "OnEndOfSegment not expected in the Mpeg2 TS parser"; |
| 185 } | 185 } |
| 186 | 186 |
| 187 void InitializeParser() { | 187 void InitializeParser() { |
| 188 parser_->Init( | 188 parser_->Init( |
| 189 base::Bind(&Mp2tStreamParserTest::OnInit, | 189 base::Bind(&Mp2tStreamParserTest::OnInit, base::Unretained(this)), |
| 190 base::Unretained(this)), | 190 base::Bind(&Mp2tStreamParserTest::OnNewConfig, base::Unretained(this)), |
| 191 base::Bind(&Mp2tStreamParserTest::OnNewConfig, | 191 base::Bind(&Mp2tStreamParserTest::OnNewBuffers, base::Unretained(this)), |
| 192 base::Unretained(this)), | |
| 193 base::Bind(&Mp2tStreamParserTest::OnNewBuffers, | |
| 194 base::Unretained(this)), | |
| 195 true, | 192 true, |
| 196 base::Bind(&Mp2tStreamParserTest::OnKeyNeeded, | 193 base::Bind(&Mp2tStreamParserTest::OnKeyNeeded, base::Unretained(this)), |
| 197 base::Unretained(this)), | 194 base::Bind(&Mp2tStreamParserTest::OnNewSegment, base::Unretained(this)), |
| 198 base::Bind(&Mp2tStreamParserTest::OnNewSegment, | |
| 199 base::Unretained(this)), | |
| 200 base::Bind(&Mp2tStreamParserTest::OnEndOfSegment, | 195 base::Bind(&Mp2tStreamParserTest::OnEndOfSegment, |
| 201 base::Unretained(this)), | 196 base::Unretained(this)), |
| 202 LogCB()); | 197 new MediaLog()); |
| 203 } | 198 } |
| 204 | 199 |
| 205 bool ParseMpeg2TsFile(const std::string& filename, int append_bytes) { | 200 bool ParseMpeg2TsFile(const std::string& filename, int append_bytes) { |
| 206 scoped_refptr<DecoderBuffer> buffer = ReadTestDataFile(filename); | 201 scoped_refptr<DecoderBuffer> buffer = ReadTestDataFile(filename); |
| 207 EXPECT_TRUE(AppendDataInPieces(buffer->data(), | 202 EXPECT_TRUE(AppendDataInPieces(buffer->data(), |
| 208 buffer->data_size(), | 203 buffer->data_size(), |
| 209 append_bytes)); | 204 append_bytes)); |
| 210 return true; | 205 return true; |
| 211 } | 206 } |
| 212 }; | 207 }; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 parser_->Flush(); | 284 parser_->Flush(); |
| 290 EXPECT_EQ(audio_frame_count_, 40); | 285 EXPECT_EQ(audio_frame_count_, 40); |
| 291 EXPECT_EQ(video_frame_count_, 0); | 286 EXPECT_EQ(video_frame_count_, 0); |
| 292 // This stream has no mid-stream configuration change. | 287 // This stream has no mid-stream configuration change. |
| 293 EXPECT_EQ(config_count_, 1); | 288 EXPECT_EQ(config_count_, 1); |
| 294 EXPECT_EQ(segment_count_, 1); | 289 EXPECT_EQ(segment_count_, 1); |
| 295 } | 290 } |
| 296 | 291 |
| 297 } // namespace mp2t | 292 } // namespace mp2t |
| 298 } // namespace media | 293 } // namespace media |
| OLD | NEW |