| 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 <sstream> | 5 #include <sstream> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 base::Bind(&EsAdapterVideoTest::OnNewBuffer, | 85 base::Bind(&EsAdapterVideoTest::OnNewBuffer, |
| 86 base::Unretained(this))) { | 86 base::Unretained(this))) { |
| 87 } | 87 } |
| 88 | 88 |
| 89 void EsAdapterVideoTest::OnNewConfig(const VideoDecoderConfig& video_config) { | 89 void EsAdapterVideoTest::OnNewConfig(const VideoDecoderConfig& video_config) { |
| 90 } | 90 } |
| 91 | 91 |
| 92 void EsAdapterVideoTest::OnNewBuffer( | 92 void EsAdapterVideoTest::OnNewBuffer( |
| 93 scoped_refptr<StreamParserBuffer> buffer) { | 93 scoped_refptr<StreamParserBuffer> buffer) { |
| 94 buffer_descriptors_ << "(" << buffer->duration().InMilliseconds() << "," | 94 buffer_descriptors_ << "(" << buffer->duration().InMilliseconds() << "," |
| 95 << (buffer->IsKeyframe() ? "Y" : "N") << ") "; | 95 << (buffer->is_key_frame() ? "Y" : "N") << ") "; |
| 96 } | 96 } |
| 97 | 97 |
| 98 std::string EsAdapterVideoTest::RunAdapterTest( | 98 std::string EsAdapterVideoTest::RunAdapterTest( |
| 99 const StreamParserBuffer::BufferQueue& buffer_queue) { | 99 const StreamParserBuffer::BufferQueue& buffer_queue) { |
| 100 buffer_descriptors_.clear(); | 100 buffer_descriptors_.clear(); |
| 101 | 101 |
| 102 es_adapter_.OnConfigChanged(CreateFakeVideoConfig()); | 102 es_adapter_.OnConfigChanged(CreateFakeVideoConfig()); |
| 103 for (StreamParserBuffer::BufferQueue::const_iterator it = | 103 for (StreamParserBuffer::BufferQueue::const_iterator it = |
| 104 buffer_queue.begin(); it != buffer_queue.end(); ++it) { | 104 buffer_queue.begin(); it != buffer_queue.end(); ++it) { |
| 105 es_adapter_.OnNewBuffer(*it); | 105 es_adapter_.OnNewBuffer(*it); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 bool is_key_frame[] = {false, false, false, true, false, false}; | 163 bool is_key_frame[] = {false, false, false, true, false, false}; |
| 164 StreamParserBuffer::BufferQueue buffer_queue = | 164 StreamParserBuffer::BufferQueue buffer_queue = |
| 165 GenerateFakeBuffers(pts_ms, is_key_frame, arraysize(pts_ms)); | 165 GenerateFakeBuffers(pts_ms, is_key_frame, arraysize(pts_ms)); |
| 166 | 166 |
| 167 EXPECT_EQ("(70,Y) (30,Y) (30,N) (30,N)", | 167 EXPECT_EQ("(70,Y) (30,Y) (30,N) (30,N)", |
| 168 RunAdapterTest(buffer_queue)); | 168 RunAdapterTest(buffer_queue)); |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace mp2t | 171 } // namespace mp2t |
| 172 } // namespace media | 172 } // namespace media |
| OLD | NEW |