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

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: rebase 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
« no previous file with comments | « media/cast/audio_sender/audio_encoder.cc ('k') | media/cast/audio_sender/audio_sender.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) { 44 EXPECT_EQ(encoded_frame->dependency, transport::EncodedFrame::KEY);
45 EXPECT_EQ(codec_, encoded_frame->codec);
46 EXPECT_EQ(static_cast<uint8>(frames_received_ & 0xff), 45 EXPECT_EQ(static_cast<uint8>(frames_received_ & 0xff),
47 encoded_frame->frame_id); 46 encoded_frame->frame_id);
47 EXPECT_EQ(encoded_frame->frame_id, encoded_frame->referenced_frame_id);
48 // RTP timestamps should be monotonically increasing and integer multiples 48 // RTP timestamps should be monotonically increasing and integer multiples
49 // of the fixed frame size. 49 // of the fixed frame size.
50 EXPECT_LE(rtp_lower_bound_, encoded_frame->rtp_timestamp); 50 EXPECT_LE(rtp_lower_bound_, encoded_frame->rtp_timestamp);
51 rtp_lower_bound_ = encoded_frame->rtp_timestamp; 51 rtp_lower_bound_ = encoded_frame->rtp_timestamp;
52 // Note: In audio_encoder.cc, 100 is the fixed audio frame rate. 52 // Note: In audio_encoder.cc, 100 is the fixed audio frame rate.
53 const int kSamplesPerFrame = kDefaultAudioSamplingRate / 100; 53 const int kSamplesPerFrame = kDefaultAudioSamplingRate / 100;
54 EXPECT_EQ(0u, encoded_frame->rtp_timestamp % kSamplesPerFrame); 54 EXPECT_EQ(0u, encoded_frame->rtp_timestamp % kSamplesPerFrame);
55 EXPECT_TRUE(!encoded_frame->data.empty()); 55 EXPECT_TRUE(!encoded_frame->data.empty());
56 56
57 EXPECT_LE(lower_bound_, recorded_time); 57 EXPECT_LE(lower_bound_, encoded_frame->reference_time);
58 lower_bound_ = recorded_time; 58 lower_bound_ = encoded_frame->reference_time;
59 EXPECT_GT(upper_bound_, recorded_time); 59 EXPECT_GT(upper_bound_, encoded_frame->reference_time);
60 60
61 ++frames_received_; 61 ++frames_received_;
62 } 62 }
63 63
64 private: 64 private:
65 const transport::AudioCodec codec_; 65 const transport::AudioCodec codec_;
66 int frames_received_; 66 int frames_received_;
67 uint32 rtp_lower_bound_; 67 uint32 rtp_lower_bound_;
68 base::TimeTicks lower_bound_; 68 base::TimeTicks lower_bound_;
69 base::TimeTicks upper_bound_; 69 base::TimeTicks upper_bound_;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 TestScenario(kManyCalls_Mixed2, arraysize(kManyCalls_Mixed2)), 235 TestScenario(kManyCalls_Mixed2, arraysize(kManyCalls_Mixed2)),
236 TestScenario(kManyCalls_Mixed3, arraysize(kManyCalls_Mixed3)), 236 TestScenario(kManyCalls_Mixed3, arraysize(kManyCalls_Mixed3)),
237 TestScenario(kManyCalls_Mixed4, arraysize(kManyCalls_Mixed4)), 237 TestScenario(kManyCalls_Mixed4, arraysize(kManyCalls_Mixed4)),
238 TestScenario(kManyCalls_Mixed5, arraysize(kManyCalls_Mixed5)), 238 TestScenario(kManyCalls_Mixed5, arraysize(kManyCalls_Mixed5)),
239 TestScenario(kOneBigUnderrun, arraysize(kOneBigUnderrun)), 239 TestScenario(kOneBigUnderrun, arraysize(kOneBigUnderrun)),
240 TestScenario(kTwoBigUnderruns, arraysize(kTwoBigUnderruns)), 240 TestScenario(kTwoBigUnderruns, arraysize(kTwoBigUnderruns)),
241 TestScenario(kMixedUnderruns, arraysize(kMixedUnderruns)))); 241 TestScenario(kMixedUnderruns, arraysize(kMixedUnderruns))));
242 242
243 } // namespace cast 243 } // namespace cast
244 } // namespace media 244 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/audio_sender/audio_encoder.cc ('k') | media/cast/audio_sender/audio_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698