Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/time.h" | 12 #include "base/time.h" |
| 13 #include "media/base/audio_decoder_config.h" | 13 #include "media/base/audio_decoder_config.h" |
| 14 #include "media/base/decoder_buffer.h" | 14 #include "media/base/decoder_buffer.h" |
| 15 #include "media/base/stream_parser_buffer.h" | 15 #include "media/base/stream_parser_buffer.h" |
| 16 #include "media/base/test_data_util.h" | 16 #include "media/base/test_data_util.h" |
| 17 #include "media/base/video_decoder_config.h" | 17 #include "media/base/video_decoder_config.h" |
| 18 #include "media/mp4/mp4_stream_parser.h" | 18 #include "media/mp4/mp4_stream_parser.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 20 | 20 |
| 21 using base::TimeDelta; | 21 using base::TimeDelta; |
| 22 | 22 |
| 23 namespace media { | 23 namespace media { |
| 24 namespace mp4 { | 24 namespace mp4 { |
| 25 | 25 |
| 26 // TODO(xhwang): Figure out the init data type appropriately once it's spec'ed. | |
| 27 static const char kMp4InitDataType[] = "video/mp4"; | |
| 28 | |
| 26 class MP4StreamParserTest : public testing::Test { | 29 class MP4StreamParserTest : public testing::Test { |
| 27 public: | 30 public: |
| 28 MP4StreamParserTest() | 31 MP4StreamParserTest() |
| 29 : parser_(new MP4StreamParser(false)), | 32 : parser_(new MP4StreamParser(false)), |
| 30 configs_received_(false) { | 33 configs_received_(false) { |
| 31 } | 34 } |
| 32 | 35 |
| 33 protected: | 36 protected: |
| 34 scoped_ptr<MP4StreamParser> parser_; | 37 scoped_ptr<MP4StreamParser> parser_; |
| 35 base::TimeDelta segment_start_; | 38 base::TimeDelta segment_start_; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 for (StreamParser::BufferQueue::const_iterator buf = bufs.begin(); | 72 for (StreamParser::BufferQueue::const_iterator buf = bufs.begin(); |
| 70 buf != bufs.end(); buf++) { | 73 buf != bufs.end(); buf++) { |
| 71 DVLOG(3) << " n=" << buf - bufs.begin() | 74 DVLOG(3) << " n=" << buf - bufs.begin() |
| 72 << ", size=" << (*buf)->GetDataSize() | 75 << ", size=" << (*buf)->GetDataSize() |
| 73 << ", dur=" << (*buf)->GetDuration().InMilliseconds(); | 76 << ", dur=" << (*buf)->GetDuration().InMilliseconds(); |
| 74 EXPECT_GE((*buf)->GetTimestamp(), segment_start_); | 77 EXPECT_GE((*buf)->GetTimestamp(), segment_start_); |
| 75 } | 78 } |
| 76 return true; | 79 return true; |
| 77 } | 80 } |
| 78 | 81 |
| 79 bool KeyNeededF(scoped_array<uint8> init_data, int init_data_size) { | 82 bool KeyNeededF(const std::string& type, |
| 83 scoped_array<uint8> init_data, int init_data_size) { | |
| 84 EXPECT_EQ(type, kMp4InitDataType); | |
|
ddorwin
2012/10/27 01:47:17
swap params
xhwang
2012/10/27 03:22:59
Done.
| |
| 80 DVLOG(1) << "KeyNeededF: " << init_data_size; | 85 DVLOG(1) << "KeyNeededF: " << init_data_size; |
|
ddorwin
2012/10/27 01:47:17
Any idea why we log but don't check this?
xhwang
2012/10/27 03:22:59
Done.
| |
| 81 return true; | 86 return true; |
| 82 } | 87 } |
| 83 | 88 |
| 84 void NewSegmentF(TimeDelta start_dts) { | 89 void NewSegmentF(TimeDelta start_dts) { |
| 85 DVLOG(1) << "NewSegmentF: " << start_dts.InMilliseconds(); | 90 DVLOG(1) << "NewSegmentF: " << start_dts.InMilliseconds(); |
| 86 segment_start_ = start_dts; | 91 segment_start_ = start_dts; |
| 87 } | 92 } |
| 88 | 93 |
| 89 void EndOfSegmentF() { | 94 void EndOfSegmentF() { |
| 90 DVLOG(1) << "EndOfSegmentF()"; | 95 DVLOG(1) << "EndOfSegmentF()"; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 EXPECT_TRUE(AppendDataInPieces(buffer->GetData(), | 159 EXPECT_TRUE(AppendDataInPieces(buffer->GetData(), |
| 155 buffer->GetDataSize(), | 160 buffer->GetDataSize(), |
| 156 512)); | 161 512)); |
| 157 } | 162 } |
| 158 | 163 |
| 159 // TODO(strobe): Create and test media which uses CENC auxiliary info stored | 164 // TODO(strobe): Create and test media which uses CENC auxiliary info stored |
| 160 // inside a private box | 165 // inside a private box |
| 161 | 166 |
| 162 } // namespace mp4 | 167 } // namespace mp4 |
| 163 } // namespace media | 168 } // namespace media |
| OLD | NEW |