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

Side by Side Diff: media/base/android/access_unit_queue.h

Issue 1128383003: Implementation of MediaCodecPlayer stage 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unused media_codec_player_state.h and .cc Created 5 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
OLDNEW
(Empty)
1 // Copyright 2015 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 MEDIA_BASE_ANDROID_ACCESS_UNIT_QUEUE_H_
6 #define MEDIA_BASE_ANDROID_ACCESS_UNIT_QUEUE_H_
7
8 #include <deque>
9
10 #include "base/macros.h"
11 #include "base/synchronization/lock.h"
12 #include "media/base/android/demuxer_stream_player_params.h"
13
14 namespace media {
15
16 // The queue of incoming data for MediaCodecDecoder.
17 //
18 // The queue is accessed on the Media thread that puts the incoming
19 // data in and the Decoder thread that gets the next access unit and
20 // eventually removes it from the queue.
21 class AccessUnitQueue {
22 public:
23 // Information about the queue state and it's front AccessUnit
wolenetz 2015/05/19 21:58:37 nit: s/it's/its/
Tima Vaisburd 2015/05/22 23:37:52 Done.
24 struct Info {
25 // The unit at front
26 const AccessUnit* front_unit;
27
28 // New configs at front.
29 // If |front_unit| is defined, |configs| is null, and vice versa.
30 const DemuxerConfigs* configs;
31
32 // Current size of the queue.
wolenetz 2015/05/19 21:58:37 Does presence of new configs change this size?
Tima Vaisburd 2015/05/22 22:48:54 Yes, |kConfigChanged| is a placeholder access unit
33 int length;
34
35 // Whether the queue containd End Of Stream.
36 bool has_eos;
37
38 Info()
39 : front_unit(nullptr), configs(nullptr), length(0), has_eos(false) {}
40 };
41
42 AccessUnitQueue();
43 virtual ~AccessUnitQueue();
wolenetz 2015/05/19 21:58:37 hmm. AccessUnitQueue doesn't derive, nor is it der
Tima Vaisburd 2015/05/22 22:48:54 Sorry, I can't see why it was virtual either. Remo
44
45 // Appends the incoming data to the queue.
46 void PushBack(const DemuxerData& frames);
47
48 // Removes one access unit from the front.
49 void PopFront();
50
51 // Clears the queue
52 void Flush();
53
54 // Looks for the first key frame and if it exists,
55 // removes prior frames and returns true. If it does not
wolenetz 2015/05/19 21:58:37 nit: squeeze 3rd line of comment onto end of 2nd?
Tima Vaisburd 2015/05/22 22:48:54 Done.
56 // exist returns false.
57 bool SkipToKeyFrame();
wolenetz 2015/05/19 21:58:37 What if there is a config prior to the keyframe?
Tima Vaisburd 2015/05/28 02:00:34 As Min pointed out below, instead of going forward
58
59 // Returns the information about the queue.
60 void GetInfo(Info* info) const;
61
62 private:
63 // The queue of access units
64 std::deque<AccessUnit> access_units_;
65
66 // The queue of corresponding configurations.
67 // Some access units has the state set to |kConfigChanged|,
68 // these units have no data and no PTS, and for each there is
wolenetz 2015/05/19 21:58:37 nit ditto: squeeze comment paragraphs into longer
Tima Vaisburd 2015/05/22 22:48:54 Done.
69 // one entry in |demuxer_configs_|
70 std::deque<DemuxerConfigs> demuxer_configs_;
71
72 // Indicates that a unit with End Of Stream flag
73 // has been appended to the queue.
74 bool has_eos_;
75
76 // The queue works on two threads.
77 mutable base::Lock lock_;
78
79 DISALLOW_COPY_AND_ASSIGN(AccessUnitQueue);
80 };
81
82 } // namespace media
83
84 // For logging
85 std::ostream& operator<<(std::ostream& os, const media::AccessUnit& au);
wolenetz 2015/05/19 21:58:37 Hmm. Put this into demuxer_stream_player_params.h
Tima Vaisburd 2015/05/22 22:48:54 Done.
86
87 #endif // MEDIA_BASE_ANDROID_ACCESS_UNIT_QUEUE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698