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

Side by Side Diff: chromecast/media/cma/base/mock_frame_consumer.h

Issue 609383004: Chromecast: adds test frame-segmenter code to support CMA unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cma-decrypt-context
Patch Set: style fixes Created 6 years, 2 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROMECAST_MEDIA_CMA_BASE_MOCK_FRAME_CONSUMER_H_
6 #define CHROMECAST_MEDIA_CMA_BASE_MOCK_FRAME_CONSUMER_H_
7
8 #include <vector>
9
10 #include "base/callback.h"
11 #include "base/macros.h"
12
13 namespace media {
14 class AudioDecoderConfig;
15 class VideoDecoderConfig;
16 }
17
18 namespace chromecast {
19 namespace media {
20 class CodedFrameProvider;
21 class DecoderBufferBase;
22 class FrameGeneratorForTest;
23
24 class MockFrameConsumer {
25 public:
26 explicit MockFrameConsumer(CodedFrameProvider* coded_frame_provider);
27 ~MockFrameConsumer();
28
29 void Configure(const std::vector<bool>& delayed_task_pattern,
30 bool last_read_aborted_by_flush,
31 scoped_ptr<FrameGeneratorForTest> frame_generator);
32
33 // Starts consuming frames. Invoke |done_cb| when all the expected frames
34 // have been received.
35 void Start(const base::Closure& done_cb);
36
37 private:
38 void ReadFrame();
39 void OnNewFrame(const scoped_refptr<DecoderBufferBase>& buffer,
40 const ::media::AudioDecoderConfig& audio_config,
41 const ::media::VideoDecoderConfig& video_config);
42
43 void OnFlushCompleted();
44
45 CodedFrameProvider* const coded_frame_provider_;
46
47 base::Closure done_cb_;
48
49 // Parameterization of the frame consumer:
50 // |delayed_task_pattern_| indicates the pattern for fetching frames,
51 // i.e. after receiving a frame, either fetch a frame right away
52 // or wait some time before fetching another frame.
53 // |pattern_idx_| is the current index in the pattern.
54 // |last_read_aborted_by_flush_| indicates whether the last buffer request
55 // should be aborted by a Flush.
56 std::vector<bool> delayed_task_pattern_;
57 size_t pattern_idx_;
58 bool last_read_aborted_by_flush_;
59
60 // Expected results.
61 scoped_ptr<FrameGeneratorForTest> frame_generator_;
62
63 DISALLOW_COPY_AND_ASSIGN(MockFrameConsumer);
64 };
65
66 } // namespace media
67 } // namespace chromecast
68
69 #endif // CHROMECAST_MEDIA_CMA_BASE_MOCK_FRAME_CONSUMER_H_
OLDNEW
« no previous file with comments | « chromecast/media/cma/base/frame_generator_for_test.cc ('k') | chromecast/media/cma/base/mock_frame_consumer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698