| 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/mpeg/mpeg1_audio_stream_parser.h" | 5 #include "media/formats/mpeg/mpeg1_audio_stream_parser.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 "{ 0K }" | 41 "{ 0K }" |
| 42 "EndOfSegment" | 42 "EndOfSegment" |
| 43 "NewSegment" | 43 "NewSegment" |
| 44 "{ 0K }" | 44 "{ 0K }" |
| 45 "{ 0K }" | 45 "{ 0K }" |
| 46 "EndOfSegment"; | 46 "EndOfSegment"; |
| 47 EXPECT_EQ(expected, ParseFile("sfx.mp3", 17)); | 47 EXPECT_EQ(expected, ParseFile("sfx.mp3", 17)); |
| 48 EXPECT_GT(last_audio_config().codec_delay(), 0); | 48 EXPECT_GT(last_audio_config().codec_delay(), 0); |
| 49 } | 49 } |
| 50 | 50 |
| 51 TEST_F(MPEG1AudioStreamParserTest, UnalignedAppendMP2) { |
| 52 const std::string expected = |
| 53 "NewSegment" |
| 54 "{ 0K }" |
| 55 "{ 0K }" |
| 56 "{ 0K }" |
| 57 "{ 0K }" |
| 58 "EndOfSegment" |
| 59 "NewSegment" |
| 60 "{ 0K }" |
| 61 "{ 0K }" |
| 62 "{ 0K }" |
| 63 "{ 0K }" |
| 64 "{ 0K }" |
| 65 "{ 0K }" |
| 66 "EndOfSegment"; |
| 67 EXPECT_EQ(expected, ParseFile("sfx.mp2", 17)); |
| 68 EXPECT_GT(last_audio_config().codec_delay(), 0); |
| 69 } |
| 70 |
| 51 // Test parsing with a larger piece size to verify that multiple buffers | 71 // Test parsing with a larger piece size to verify that multiple buffers |
| 52 // are passed to |new_buffer_cb_|. | 72 // are passed to |new_buffer_cb_|. |
| 53 TEST_F(MPEG1AudioStreamParserTest, UnalignedAppend512) { | 73 TEST_F(MPEG1AudioStreamParserTest, UnalignedAppend512) { |
| 54 const std::string expected = | 74 const std::string expected = |
| 55 "NewSegment" | 75 "NewSegment" |
| 56 "{ 0K 26K 52K 78K }" | 76 "{ 0K 26K 52K 78K }" |
| 57 "EndOfSegment" | 77 "EndOfSegment" |
| 58 "NewSegment" | 78 "NewSegment" |
| 59 "{ 0K 26K 52K }" | 79 "{ 0K 26K 52K }" |
| 60 "{ 0K 26K 52K 78K }" | 80 "{ 0K 26K 52K 78K }" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 91 buffer_ptr += kXingRemainingSize; | 111 buffer_ptr += kXingRemainingSize; |
| 92 | 112 |
| 93 // Append the first real frame and ensure we get a segment. | 113 // Append the first real frame and ensure we get a segment. |
| 94 const int kFirstRealFrameSize = 182; | 114 const int kFirstRealFrameSize = 182; |
| 95 EXPECT_EQ("NewSegment{ 0K }EndOfSegment", | 115 EXPECT_EQ("NewSegment{ 0K }EndOfSegment", |
| 96 ParseData(buffer_ptr, kFirstRealFrameSize)); | 116 ParseData(buffer_ptr, kFirstRealFrameSize)); |
| 97 EXPECT_TRUE(last_audio_config().IsValidConfig()); | 117 EXPECT_TRUE(last_audio_config().IsValidConfig()); |
| 98 } | 118 } |
| 99 | 119 |
| 100 } // namespace media | 120 } // namespace media |
| OLD | NEW |