| 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/common/stream_parser_test_base.h" | 5 #include "media/formats/common/stream_parser_test_base.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "media/base/media_track.h" |
| 11 #include "media/base/media_tracks.h" |
| 10 #include "media/base/test_data_util.h" | 12 #include "media/base/test_data_util.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 14 |
| 13 namespace media { | 15 namespace media { |
| 14 | 16 |
| 15 static std::string BufferQueueToString( | 17 static std::string BufferQueueToString( |
| 16 const StreamParser::BufferQueue& buffers) { | 18 const StreamParser::BufferQueue& buffers) { |
| 17 std::stringstream ss; | 19 std::stringstream ss; |
| 18 | 20 |
| 19 ss << "{"; | 21 ss << "{"; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 } | 78 } |
| 77 | 79 |
| 78 void StreamParserTestBase::OnInitDone( | 80 void StreamParserTestBase::OnInitDone( |
| 79 const StreamParser::InitParameters& params) { | 81 const StreamParser::InitParameters& params) { |
| 80 EXPECT_TRUE(params.auto_update_timestamp_offset); | 82 EXPECT_TRUE(params.auto_update_timestamp_offset); |
| 81 DVLOG(1) << __FUNCTION__ << "(" << params.duration.InMilliseconds() << ", " | 83 DVLOG(1) << __FUNCTION__ << "(" << params.duration.InMilliseconds() << ", " |
| 82 << params.auto_update_timestamp_offset << ")"; | 84 << params.auto_update_timestamp_offset << ")"; |
| 83 } | 85 } |
| 84 | 86 |
| 85 bool StreamParserTestBase::OnNewConfig( | 87 bool StreamParserTestBase::OnNewConfig( |
| 86 const AudioDecoderConfig& audio_config, | 88 scoped_ptr<MediaTracks> tracks, |
| 87 const VideoDecoderConfig& video_config, | |
| 88 const StreamParser::TextTrackConfigMap& text_config) { | 89 const StreamParser::TextTrackConfigMap& text_config) { |
| 89 DVLOG(1) << __FUNCTION__ << "(" << audio_config.IsValidConfig() << ", " | 90 DVLOG(1) << __FUNCTION__ << " media tracks count=" << tracks->tracks().size(); |
| 90 << video_config.IsValidConfig() << ")"; | 91 EXPECT_EQ(tracks->tracks().size(), 1u); |
| 91 EXPECT_TRUE(audio_config.IsValidConfig()); | 92 EXPECT_TRUE(tracks->getFirstAudioConfig().IsValidConfig()); |
| 92 EXPECT_FALSE(video_config.IsValidConfig()); | 93 EXPECT_FALSE(tracks->getFirstVideoConfig().IsValidConfig()); |
| 93 last_audio_config_ = audio_config; | 94 last_audio_config_ = tracks->getFirstAudioConfig(); |
| 94 return true; | 95 return true; |
| 95 } | 96 } |
| 96 | 97 |
| 97 bool StreamParserTestBase::OnNewBuffers( | 98 bool StreamParserTestBase::OnNewBuffers( |
| 98 const StreamParser::BufferQueue& audio_buffers, | 99 const StreamParser::BufferQueue& audio_buffers, |
| 99 const StreamParser::BufferQueue& video_buffers, | 100 const StreamParser::BufferQueue& video_buffers, |
| 100 const StreamParser::TextBufferQueueMap& text_map) { | 101 const StreamParser::TextBufferQueueMap& text_map) { |
| 101 EXPECT_FALSE(audio_buffers.empty()); | 102 EXPECT_FALSE(audio_buffers.empty()); |
| 102 EXPECT_TRUE(video_buffers.empty()); | 103 EXPECT_TRUE(video_buffers.empty()); |
| 103 | 104 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 121 DVLOG(1) << __FUNCTION__; | 122 DVLOG(1) << __FUNCTION__; |
| 122 results_stream_ << "NewSegment"; | 123 results_stream_ << "NewSegment"; |
| 123 } | 124 } |
| 124 | 125 |
| 125 void StreamParserTestBase::OnEndOfSegment() { | 126 void StreamParserTestBase::OnEndOfSegment() { |
| 126 DVLOG(1) << __FUNCTION__; | 127 DVLOG(1) << __FUNCTION__; |
| 127 results_stream_ << "EndOfSegment"; | 128 results_stream_ << "EndOfSegment"; |
| 128 } | 129 } |
| 129 | 130 |
| 130 } // namespace media | 131 } // namespace media |
| OLD | NEW |