Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(459)

Side by Side Diff: media/cast/audio_sender/audio_encoder_unittest.cc

Issue 288103002: [Cast] EncodedAudioFrame+EncodedVideoFrame+reference_time --> EncodedFrame (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <sstream> 7 #include <sstream>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 22 matching lines...) Expand all
33 virtual ~TestEncodedAudioFrameReceiver() {} 33 virtual ~TestEncodedAudioFrameReceiver() {}
34 34
35 int frames_received() const { return frames_received_; } 35 int frames_received() const { return frames_received_; }
36 36
37 void SetCaptureTimeBounds(const base::TimeTicks& lower_bound, 37 void SetCaptureTimeBounds(const base::TimeTicks& lower_bound,
38 const base::TimeTicks& upper_bound) { 38 const base::TimeTicks& upper_bound) {
39 lower_bound_ = lower_bound; 39 lower_bound_ = lower_bound;
40 upper_bound_ = upper_bound; 40 upper_bound_ = upper_bound;
41 } 41 }
42 42
43 void FrameEncoded(scoped_ptr<transport::EncodedAudioFrame> encoded_frame, 43 void FrameEncoded(scoped_ptr<transport::EncodedFrame> encoded_frame) {
44 const base::TimeTicks& recorded_time) {
45 EXPECT_EQ(codec_, encoded_frame->codec);
46 EXPECT_EQ(static_cast<uint8>(frames_received_ & 0xff), 44 EXPECT_EQ(static_cast<uint8>(frames_received_ & 0xff),
47 encoded_frame->frame_id); 45 encoded_frame->frame_id);
46 EXPECT_EQ(encoded_frame->frame_id, encoded_frame->base_frame_id);
48 // RTP timestamps should be monotonically increasing and integer multiples 47 // RTP timestamps should be monotonically increasing and integer multiples
49 // of the fixed frame size. 48 // of the fixed frame size.
50 EXPECT_LE(rtp_lower_bound_, encoded_frame->rtp_timestamp); 49 EXPECT_LE(rtp_lower_bound_, encoded_frame->rtp_timestamp);
51 rtp_lower_bound_ = encoded_frame->rtp_timestamp; 50 rtp_lower_bound_ = encoded_frame->rtp_timestamp;
52 // Note: In audio_encoder.cc, 100 is the fixed audio frame rate. 51 // Note: In audio_encoder.cc, 100 is the fixed audio frame rate.
53 const int kSamplesPerFrame = kDefaultAudioSamplingRate / 100; 52 const int kSamplesPerFrame = kDefaultAudioSamplingRate / 100;
54 EXPECT_EQ(0u, encoded_frame->rtp_timestamp % kSamplesPerFrame); 53 EXPECT_EQ(0u, encoded_frame->rtp_timestamp % kSamplesPerFrame);
55 EXPECT_TRUE(!encoded_frame->data.empty()); 54 EXPECT_TRUE(!encoded_frame->data.empty());
56 55
57 EXPECT_LE(lower_bound_, recorded_time); 56 EXPECT_LE(lower_bound_, encoded_frame->reference_time);
58 lower_bound_ = recorded_time; 57 lower_bound_ = encoded_frame->reference_time;
59 EXPECT_GT(upper_bound_, recorded_time); 58 EXPECT_GT(upper_bound_, encoded_frame->reference_time);
60 59
61 ++frames_received_; 60 ++frames_received_;
62 } 61 }
63 62
64 private: 63 private:
65 const transport::AudioCodec codec_; 64 const transport::AudioCodec codec_;
66 int frames_received_; 65 int frames_received_;
67 uint32 rtp_lower_bound_; 66 uint32 rtp_lower_bound_;
68 base::TimeTicks lower_bound_; 67 base::TimeTicks lower_bound_;
69 base::TimeTicks upper_bound_; 68 base::TimeTicks upper_bound_;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 TestScenario(kManyCalls_Mixed2, arraysize(kManyCalls_Mixed2)), 234 TestScenario(kManyCalls_Mixed2, arraysize(kManyCalls_Mixed2)),
236 TestScenario(kManyCalls_Mixed3, arraysize(kManyCalls_Mixed3)), 235 TestScenario(kManyCalls_Mixed3, arraysize(kManyCalls_Mixed3)),
237 TestScenario(kManyCalls_Mixed4, arraysize(kManyCalls_Mixed4)), 236 TestScenario(kManyCalls_Mixed4, arraysize(kManyCalls_Mixed4)),
238 TestScenario(kManyCalls_Mixed5, arraysize(kManyCalls_Mixed5)), 237 TestScenario(kManyCalls_Mixed5, arraysize(kManyCalls_Mixed5)),
239 TestScenario(kOneBigUnderrun, arraysize(kOneBigUnderrun)), 238 TestScenario(kOneBigUnderrun, arraysize(kOneBigUnderrun)),
240 TestScenario(kTwoBigUnderruns, arraysize(kTwoBigUnderruns)), 239 TestScenario(kTwoBigUnderruns, arraysize(kTwoBigUnderruns)),
241 TestScenario(kMixedUnderruns, arraysize(kMixedUnderruns)))); 240 TestScenario(kMixedUnderruns, arraysize(kMixedUnderruns))));
242 241
243 } // namespace cast 242 } // namespace cast
244 } // namespace media 243 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698