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> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "media/base/test_data_util.h" | 10 #include "media/base/test_data_util.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
10 | 12 |
11 namespace media { | 13 namespace media { |
12 | 14 |
13 static std::string BufferQueueToString( | 15 static std::string BufferQueueToString( |
14 const StreamParser::BufferQueue& buffers) { | 16 const StreamParser::BufferQueue& buffers) { |
15 std::stringstream ss; | 17 std::stringstream ss; |
16 | 18 |
17 ss << "{"; | 19 ss << "{"; |
18 for (StreamParser::BufferQueue::const_iterator itr = buffers.begin(); | 20 for (StreamParser::BufferQueue::const_iterator itr = buffers.begin(); |
19 itr != buffers.end(); | 21 itr != buffers.end(); |
20 ++itr) { | 22 ++itr) { |
21 ss << " " << (*itr)->timestamp().InMilliseconds(); | 23 ss << " " << (*itr)->timestamp().InMilliseconds(); |
22 if ((*itr)->is_key_frame()) | 24 if ((*itr)->is_key_frame()) |
23 ss << "K"; | 25 ss << "K"; |
24 } | 26 } |
25 ss << " }"; | 27 ss << " }"; |
26 | 28 |
27 return ss.str(); | 29 return ss.str(); |
28 } | 30 } |
29 | 31 |
30 StreamParserTestBase::StreamParserTestBase( | 32 StreamParserTestBase::StreamParserTestBase( |
31 scoped_ptr<StreamParser> stream_parser) | 33 scoped_ptr<StreamParser> stream_parser) |
32 : parser_(stream_parser.Pass()) { | 34 : parser_(std::move(stream_parser)) { |
33 parser_->Init( | 35 parser_->Init( |
34 base::Bind(&StreamParserTestBase::OnInitDone, base::Unretained(this)), | 36 base::Bind(&StreamParserTestBase::OnInitDone, base::Unretained(this)), |
35 base::Bind(&StreamParserTestBase::OnNewConfig, base::Unretained(this)), | 37 base::Bind(&StreamParserTestBase::OnNewConfig, base::Unretained(this)), |
36 base::Bind(&StreamParserTestBase::OnNewBuffers, base::Unretained(this)), | 38 base::Bind(&StreamParserTestBase::OnNewBuffers, base::Unretained(this)), |
37 true, | 39 true, |
38 base::Bind(&StreamParserTestBase::OnKeyNeeded, base::Unretained(this)), | 40 base::Bind(&StreamParserTestBase::OnKeyNeeded, base::Unretained(this)), |
39 base::Bind(&StreamParserTestBase::OnNewSegment, base::Unretained(this)), | 41 base::Bind(&StreamParserTestBase::OnNewSegment, base::Unretained(this)), |
40 base::Bind(&StreamParserTestBase::OnEndOfSegment, base::Unretained(this)), | 42 base::Bind(&StreamParserTestBase::OnEndOfSegment, base::Unretained(this)), |
41 new MediaLog()); | 43 new MediaLog()); |
42 } | 44 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 DVLOG(1) << __FUNCTION__; | 121 DVLOG(1) << __FUNCTION__; |
120 results_stream_ << "NewSegment"; | 122 results_stream_ << "NewSegment"; |
121 } | 123 } |
122 | 124 |
123 void StreamParserTestBase::OnEndOfSegment() { | 125 void StreamParserTestBase::OnEndOfSegment() { |
124 DVLOG(1) << __FUNCTION__; | 126 DVLOG(1) << __FUNCTION__; |
125 results_stream_ << "EndOfSegment"; | 127 results_stream_ << "EndOfSegment"; |
126 } | 128 } |
127 | 129 |
128 } // namespace media | 130 } // namespace media |
OLD | NEW |