Chromium Code Reviews| 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 parsing with small prime sized chunks to smoke out "power of | |
| 52 // 2" field size assumptions. | |
|
chcunningham
2017/02/22 00:49:04
Is this just theoretical? I'm not aware of any pow
DaleCurtis
2017/02/22 00:53:11
Yes I think it's just theoretical, but that's how
chcunningham
2017/02/22 01:13:48
Sorry, missed that. Your first segment isn't prime
DaleCurtis
2017/02/22 01:20:14
Done.
| |
| 53 TEST_F(MPEG1AudioStreamParserTest, UnalignedAppendMP2) { | |
| 54 const std::string expected = | |
| 55 "NewSegment" | |
| 56 "{ 0K }" | |
| 57 "{ 0K }" | |
|
chcunningham
2017/02/22 00:49:03
Why are the timestamps not increasing?
DaleCurtis
2017/02/22 00:53:11
Timestamps restart per append; so the small append
chcunningham
2017/02/22 01:13:48
Ah, yeah. timestampOffset gets updated at the boun
| |
| 58 "{ 0K }" | |
| 59 "{ 0K }" | |
| 60 "EndOfSegment" | |
| 61 "NewSegment" | |
| 62 "{ 0K }" | |
| 63 "{ 0K }" | |
| 64 "{ 0K }" | |
| 65 "{ 0K }" | |
| 66 "{ 0K }" | |
| 67 "{ 0K }" | |
| 68 "EndOfSegment"; | |
| 69 EXPECT_EQ(expected, ParseFile("sfx.mp2", 17)); | |
| 70 EXPECT_GT(last_audio_config().codec_delay(), 0); | |
| 71 } | |
| 72 | |
| 51 // Test parsing with a larger piece size to verify that multiple buffers | 73 // Test parsing with a larger piece size to verify that multiple buffers |
| 52 // are passed to |new_buffer_cb_|. | 74 // are passed to |new_buffer_cb_|. |
| 53 TEST_F(MPEG1AudioStreamParserTest, UnalignedAppend512) { | 75 TEST_F(MPEG1AudioStreamParserTest, UnalignedAppend512) { |
| 54 const std::string expected = | 76 const std::string expected = |
| 55 "NewSegment" | 77 "NewSegment" |
| 56 "{ 0K 26K 52K 78K }" | 78 "{ 0K 26K 52K 78K }" |
| 57 "EndOfSegment" | 79 "EndOfSegment" |
| 58 "NewSegment" | 80 "NewSegment" |
| 59 "{ 0K 26K 52K }" | 81 "{ 0K 26K 52K }" |
| 60 "{ 0K 26K 52K 78K }" | 82 "{ 0K 26K 52K 78K }" |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 91 buffer_ptr += kXingRemainingSize; | 113 buffer_ptr += kXingRemainingSize; |
| 92 | 114 |
| 93 // Append the first real frame and ensure we get a segment. | 115 // Append the first real frame and ensure we get a segment. |
| 94 const int kFirstRealFrameSize = 182; | 116 const int kFirstRealFrameSize = 182; |
| 95 EXPECT_EQ("NewSegment{ 0K }EndOfSegment", | 117 EXPECT_EQ("NewSegment{ 0K }EndOfSegment", |
| 96 ParseData(buffer_ptr, kFirstRealFrameSize)); | 118 ParseData(buffer_ptr, kFirstRealFrameSize)); |
| 97 EXPECT_TRUE(last_audio_config().IsValidConfig()); | 119 EXPECT_TRUE(last_audio_config().IsValidConfig()); |
| 98 } | 120 } |
| 99 | 121 |
| 100 } // namespace media | 122 } // namespace media |
| OLD | NEW |