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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "media/base/video_frame.h" | 10 #include "media/base/video_frame.h" |
(...skipping 18 matching lines...) Expand all Loading... | |
29 void SetExpectedResult(uint32 expected_frame_id, | 29 void SetExpectedResult(uint32 expected_frame_id, |
30 uint32 expected_last_referenced_frame_id, | 30 uint32 expected_last_referenced_frame_id, |
31 const base::TimeTicks& expected_capture_time) { | 31 const base::TimeTicks& expected_capture_time) { |
32 expected_frame_id_ = expected_frame_id; | 32 expected_frame_id_ = expected_frame_id; |
33 expected_last_referenced_frame_id_ = expected_last_referenced_frame_id; | 33 expected_last_referenced_frame_id_ = expected_last_referenced_frame_id; |
34 expected_capture_time_ = expected_capture_time; | 34 expected_capture_time_ = expected_capture_time; |
35 } | 35 } |
36 | 36 |
37 void DeliverEncodedVideoFrame( | 37 void DeliverEncodedVideoFrame( |
38 scoped_ptr<EncodedFrame> encoded_frame) { | 38 scoped_ptr<EncodedFrame> encoded_frame) { |
39 if (expected_frame_id_ == expected_last_referenced_frame_id_) { | 39 if (expected_frame_id_ != expected_last_referenced_frame_id_) { |
miu
2014/09/02 19:22:03
If this assumption is no longer true, should we be
hubbe
2014/09/02 21:39:48
I think I'm going to try to make the dependency in
| |
40 EXPECT_EQ(EncodedFrame::KEY, encoded_frame->dependency); | |
41 } else { | |
42 EXPECT_EQ(EncodedFrame::DEPENDENT, | 40 EXPECT_EQ(EncodedFrame::DEPENDENT, |
43 encoded_frame->dependency); | 41 encoded_frame->dependency); |
44 } | 42 } |
45 EXPECT_EQ(expected_frame_id_, encoded_frame->frame_id); | 43 EXPECT_EQ(expected_frame_id_, encoded_frame->frame_id); |
46 EXPECT_EQ(expected_last_referenced_frame_id_, | 44 EXPECT_EQ(expected_last_referenced_frame_id_, |
47 encoded_frame->referenced_frame_id); | 45 encoded_frame->referenced_frame_id) |
46 << "frame id: " << expected_frame_id_; | |
48 EXPECT_EQ(expected_capture_time_, encoded_frame->reference_time); | 47 EXPECT_EQ(expected_capture_time_, encoded_frame->reference_time); |
49 } | 48 } |
50 | 49 |
51 protected: | 50 protected: |
52 virtual ~TestVideoEncoderCallback() {} | 51 virtual ~TestVideoEncoderCallback() {} |
53 | 52 |
54 private: | 53 private: |
55 friend class base::RefCountedThreadSafe<TestVideoEncoderCallback>; | 54 friend class base::RefCountedThreadSafe<TestVideoEncoderCallback>; |
56 | 55 |
57 uint32 expected_frame_id_; | 56 uint32 expected_frame_id_; |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
251 for (int i = 5; i < 17; ++i) { | 250 for (int i = 5; i < 17; ++i) { |
252 test_video_encoder_callback_->SetExpectedResult(i, 4, capture_time); | 251 test_video_encoder_callback_->SetExpectedResult(i, 4, capture_time); |
253 EXPECT_TRUE(video_encoder_->EncodeVideoFrame( | 252 EXPECT_TRUE(video_encoder_->EncodeVideoFrame( |
254 video_frame_, capture_time, frame_encoded_callback)); | 253 video_frame_, capture_time, frame_encoded_callback)); |
255 task_runner_->RunTasks(); | 254 task_runner_->RunTasks(); |
256 } | 255 } |
257 } | 256 } |
258 | 257 |
259 } // namespace cast | 258 } // namespace cast |
260 } // namespace media | 259 } // namespace media |
OLD | NEW |