| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 int timestamp_in_ms = 0; | 176 int timestamp_in_ms = 0; |
| 177 if (base::StringToInt(token, ×tamp_in_ms)) { | 177 if (base::StringToInt(token, ×tamp_in_ms)) { |
| 178 gfx::Size natural_size = TestVideoConfig::NormalCodedSize(); | 178 gfx::Size natural_size = TestVideoConfig::NormalCodedSize(); |
| 179 scoped_refptr<VideoFrame> frame = VideoFrame::CreateFrame( | 179 scoped_refptr<VideoFrame> frame = VideoFrame::CreateFrame( |
| 180 PIXEL_FORMAT_YV12, natural_size, gfx::Rect(natural_size), | 180 PIXEL_FORMAT_YV12, natural_size, gfx::Rect(natural_size), |
| 181 natural_size, base::TimeDelta::FromMilliseconds(timestamp_in_ms)); | 181 natural_size, base::TimeDelta::FromMilliseconds(timestamp_in_ms)); |
| 182 QueueFrame(DecodeStatus::OK, frame); | 182 QueueFrame(DecodeStatus::OK, frame); |
| 183 continue; | 183 continue; |
| 184 } | 184 } |
| 185 | 185 |
| 186 CHECK(false) << "Unrecognized decoder buffer token: " << token; | 186 // Unrecognized decoder buffer token. |
| 187 CHECK(false); |
| 187 } | 188 } |
| 188 } | 189 } |
| 189 | 190 |
| 190 // Queues video frames to be served by the decoder during rendering. | 191 // Queues video frames to be served by the decoder during rendering. |
| 191 void QueueFrame(DecodeStatus status, scoped_refptr<VideoFrame> frame) { | 192 void QueueFrame(DecodeStatus status, scoped_refptr<VideoFrame> frame) { |
| 192 decode_results_.push_back(std::make_pair(status, frame)); | 193 decode_results_.push_back(std::make_pair(status, frame)); |
| 193 } | 194 } |
| 194 | 195 |
| 195 bool IsReadPending() { | 196 bool IsReadPending() { |
| 196 return !decode_cb_.is_null(); | 197 return !decode_cb_.is_null(); |
| (...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 QueueFrames("0 10 20 30"); | 1185 QueueFrames("0 10 20 30"); |
| 1185 StartPlayingFrom(0); | 1186 StartPlayingFrom(0); |
| 1186 Flush(); | 1187 Flush(); |
| 1187 ASSERT_EQ(1u, frame_ready_cbs_.size()); | 1188 ASSERT_EQ(1u, frame_ready_cbs_.size()); |
| 1188 // This frame will be discarded. | 1189 // This frame will be discarded. |
| 1189 frame_ready_cbs_.front().Run(); | 1190 frame_ready_cbs_.front().Run(); |
| 1190 Destroy(); | 1191 Destroy(); |
| 1191 } | 1192 } |
| 1192 | 1193 |
| 1193 } // namespace media | 1194 } // namespace media |
| OLD | NEW |