| 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 <deque> | 5 #include <deque> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // doesn't have to account for rounding errors. | 106 // doesn't have to account for rounding errors. |
| 107 config_.max_frame_rate = 25; | 107 config_.max_frame_rate = 25; |
| 108 | 108 |
| 109 receiver_.reset(new FrameReceiver( | 109 receiver_.reset(new FrameReceiver( |
| 110 cast_environment_, config_, VIDEO_EVENT, &mock_transport_)); | 110 cast_environment_, config_, VIDEO_EVENT, &mock_transport_)); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void FeedOneFrameIntoReceiver() { | 113 void FeedOneFrameIntoReceiver() { |
| 114 // Note: For testing purposes, a frame consists of only a single packet. | 114 // Note: For testing purposes, a frame consists of only a single packet. |
| 115 receiver_->ProcessParsedPacket( | 115 receiver_->ProcessParsedPacket( |
| 116 rtp_header_, payload_.data(), payload_.size()); | 116 rtp_header_, &payload_[0], payload_.size()); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void FeedLipSyncInfoIntoReceiver() { | 119 void FeedLipSyncInfoIntoReceiver() { |
| 120 const base::TimeTicks now = testing_clock_->NowTicks(); | 120 const base::TimeTicks now = testing_clock_->NowTicks(); |
| 121 const int64 rtp_timestamp = (now - start_time_) * | 121 const int64 rtp_timestamp = (now - start_time_) * |
| 122 config_.frequency / base::TimeDelta::FromSeconds(1); | 122 config_.frequency / base::TimeDelta::FromSeconds(1); |
| 123 CHECK_LE(0, rtp_timestamp); | 123 CHECK_LE(0, rtp_timestamp); |
| 124 uint32 ntp_seconds; | 124 uint32 ntp_seconds; |
| 125 uint32 ntp_fraction; | 125 uint32 ntp_fraction; |
| 126 ConvertTimeTicksToNtp(now, &ntp_seconds, &ntp_fraction); | 126 ConvertTimeTicksToNtp(now, &ntp_seconds, &ntp_fraction); |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 EXPECT_GE(kFirstFrameId + 3, frame_events[i].frame_id); | 410 EXPECT_GE(kFirstFrameId + 3, frame_events[i].frame_id); |
| 411 const int frame_offset = frame_events[i].frame_id - kFirstFrameId; | 411 const int frame_offset = frame_events[i].frame_id - kFirstFrameId; |
| 412 EXPECT_EQ(frame_offset * rtp_advance_per_frame, | 412 EXPECT_EQ(frame_offset * rtp_advance_per_frame, |
| 413 frame_events[i].rtp_timestamp); | 413 frame_events[i].rtp_timestamp); |
| 414 } | 414 } |
| 415 cast_environment_->Logging()->RemoveRawEventSubscriber(&event_subscriber); | 415 cast_environment_->Logging()->RemoveRawEventSubscriber(&event_subscriber); |
| 416 } | 416 } |
| 417 | 417 |
| 418 } // namespace cast | 418 } // namespace cast |
| 419 } // namespace media | 419 } // namespace media |
| OLD | NEW |