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

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

Issue 545593002: [Cast] Track audio queued in encoder; account for it in ShouldDropNextFrame(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
OLDNEW
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 <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 21 matching lines...) Expand all
32 virtual ~TestEncodedAudioFrameReceiver() {} 32 virtual ~TestEncodedAudioFrameReceiver() {}
33 33
34 int frames_received() const { return frames_received_; } 34 int frames_received() const { return frames_received_; }
35 35
36 void SetCaptureTimeBounds(const base::TimeTicks& lower_bound, 36 void SetCaptureTimeBounds(const base::TimeTicks& lower_bound,
37 const base::TimeTicks& upper_bound) { 37 const base::TimeTicks& upper_bound) {
38 lower_bound_ = lower_bound; 38 lower_bound_ = lower_bound;
39 upper_bound_ = upper_bound; 39 upper_bound_ = upper_bound;
40 } 40 }
41 41
42 void FrameEncoded(scoped_ptr<EncodedFrame> encoded_frame) { 42 void FrameEncoded(scoped_ptr<EncodedFrame> encoded_frame,
43 int samples_skipped) {
43 EXPECT_EQ(encoded_frame->dependency, EncodedFrame::KEY); 44 EXPECT_EQ(encoded_frame->dependency, EncodedFrame::KEY);
44 EXPECT_EQ(static_cast<uint8>(frames_received_ & 0xff), 45 EXPECT_EQ(static_cast<uint8>(frames_received_ & 0xff),
45 encoded_frame->frame_id); 46 encoded_frame->frame_id);
46 EXPECT_EQ(encoded_frame->frame_id, encoded_frame->referenced_frame_id); 47 EXPECT_EQ(encoded_frame->frame_id, encoded_frame->referenced_frame_id);
47 // RTP timestamps should be monotonically increasing and integer multiples 48 // RTP timestamps should be monotonically increasing and integer multiples
48 // of the fixed frame size. 49 // of the fixed frame size.
49 EXPECT_LE(rtp_lower_bound_, encoded_frame->rtp_timestamp); 50 EXPECT_LE(rtp_lower_bound_, encoded_frame->rtp_timestamp);
50 rtp_lower_bound_ = encoded_frame->rtp_timestamp; 51 rtp_lower_bound_ = encoded_frame->rtp_timestamp;
51 // 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.
52 const int kSamplesPerFrame = kDefaultAudioSamplingRate / 100; 53 const int kSamplesPerFrame = kDefaultAudioSamplingRate / 100;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 TestScenario(kManyCalls_Mixed2, arraysize(kManyCalls_Mixed2)), 233 TestScenario(kManyCalls_Mixed2, arraysize(kManyCalls_Mixed2)),
233 TestScenario(kManyCalls_Mixed3, arraysize(kManyCalls_Mixed3)), 234 TestScenario(kManyCalls_Mixed3, arraysize(kManyCalls_Mixed3)),
234 TestScenario(kManyCalls_Mixed4, arraysize(kManyCalls_Mixed4)), 235 TestScenario(kManyCalls_Mixed4, arraysize(kManyCalls_Mixed4)),
235 TestScenario(kManyCalls_Mixed5, arraysize(kManyCalls_Mixed5)), 236 TestScenario(kManyCalls_Mixed5, arraysize(kManyCalls_Mixed5)),
236 TestScenario(kOneBigUnderrun, arraysize(kOneBigUnderrun)), 237 TestScenario(kOneBigUnderrun, arraysize(kOneBigUnderrun)),
237 TestScenario(kTwoBigUnderruns, arraysize(kTwoBigUnderruns)), 238 TestScenario(kTwoBigUnderruns, arraysize(kTwoBigUnderruns)),
238 TestScenario(kMixedUnderruns, arraysize(kMixedUnderruns)))); 239 TestScenario(kMixedUnderruns, arraysize(kMixedUnderruns))));
239 240
240 } // namespace cast 241 } // namespace cast
241 } // namespace media 242 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698