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

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

Issue 1287423004: MediaCodecPlayer implementation (stage 5 - reconfiguration) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mtplayer-cleanuptest
Patch Set: Avoid potential frame skipping after decoder drain with a new prerolling mode Created 5 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 2015 The Chromium Authors. All rights reserved. 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 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 #ifndef MEDIA_BASE_ANDROID_ACCESS_UNIT_QUEUE_H_ 5 #ifndef MEDIA_BASE_ANDROID_ACCESS_UNIT_QUEUE_H_
6 #define MEDIA_BASE_ANDROID_ACCESS_UNIT_QUEUE_H_ 6 #define MEDIA_BASE_ANDROID_ACCESS_UNIT_QUEUE_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 22 matching lines...) Expand all
33 const AccessUnit* front_unit; 33 const AccessUnit* front_unit;
34 34
35 // Configs for the front unit if it is |kConfigChanged|, null otherwise. 35 // Configs for the front unit if it is |kConfigChanged|, null otherwise.
36 // The same validity rule applies: this pointer is only valid till the next 36 // The same validity rule applies: this pointer is only valid till the next
37 // Advance() or Flush() call, and |configs| is owned by the queue itself. 37 // Advance() or Flush() call, and |configs| is owned by the queue itself.
38 const DemuxerConfigs* configs; 38 const DemuxerConfigs* configs;
39 39
40 // Number of access units in the queue. 40 // Number of access units in the queue.
41 int length; 41 int length;
42 42
43 // Number of access units in the queue excluding config units.
44 int data_length;
45
43 // Whether End Of Stream has been added to the queue. Cleared by Flush(). 46 // Whether End Of Stream has been added to the queue. Cleared by Flush().
44 bool has_eos; 47 bool has_eos;
45 48
46 Info() : front_unit(nullptr), configs(nullptr), length(0), has_eos(false) {} 49 Info() : front_unit(nullptr), configs(nullptr), length(0), has_eos(false) {}
47 }; 50 };
48 51
49 AccessUnitQueue(); 52 AccessUnitQueue();
50 ~AccessUnitQueue(); 53 ~AccessUnitQueue();
51 54
52 // Appends the incoming data to the queue. 55 // Appends the incoming data to the queue.
(...skipping 15 matching lines...) Expand all
68 // Returns the information about the queue. 71 // Returns the information about the queue.
69 // The result is invalidated by the following Advance() or Flush call. 72 // The result is invalidated by the following Advance() or Flush call.
70 // There must be only one |Info| consumer at a time. 73 // There must be only one |Info| consumer at a time.
71 Info GetInfo() const; 74 Info GetInfo() const;
72 75
73 // For unit tests only. These methods are not thread safe. 76 // For unit tests only. These methods are not thread safe.
74 size_t NumChunksForTesting() const { return chunks_.size(); } 77 size_t NumChunksForTesting() const { return chunks_.size(); }
75 void SetHistorySizeForTesting(size_t number_of_history_chunks); 78 void SetHistorySizeForTesting(size_t number_of_history_chunks);
76 79
77 private: 80 private:
78 // Returns the amount of access units between the current one and the end, 81 // Returns the total number of access (total_length) and the number of units
qinmin 2015/08/27 19:38:42 s/access/access units/
Tima Vaisburd 2015/08/27 20:39:47 Done.
79 // incuding current. Logically these are units that have not been consumed. 82 // excluding configiration change requests (data_length). The number is
80 int GetUnconsumedAccessUnitLength() const; 83 // calculated between the current one and the end, incuding the current.
84 // Logically these are units that have not been consumed.
85 void GetUnconsumedAccessUnitLength(int* total_length, int* data_length) const;
81 86
82 // The queue of data chunks. It owns the chunks. 87 // The queue of data chunks. It owns the chunks.
83 typedef std::list<DemuxerData*> DataChunkQueue; 88 typedef std::list<DemuxerData*> DataChunkQueue;
84 DataChunkQueue chunks_; 89 DataChunkQueue chunks_;
85 90
86 // The chunk that contains the current access unit. 91 // The chunk that contains the current access unit.
87 DataChunkQueue::iterator current_chunk_; 92 DataChunkQueue::iterator current_chunk_;
88 93
89 // Index of the current access unit within the current chunk. 94 // Index of the current access unit within the current chunk.
90 size_t index_in_chunk_; 95 size_t index_in_chunk_;
91 96
92 // Amount of chunks before the |current_chunk_| that's kept for history. 97 // Amount of chunks before the |current_chunk_| that's kept for history.
93 size_t history_chunks_amount_; 98 size_t history_chunks_amount_;
94 99
95 // Indicates that a unit with End Of Stream flag has been appended. 100 // Indicates that a unit with End Of Stream flag has been appended.
96 bool has_eos_; 101 bool has_eos_;
97 102
98 // The lock protects all fields together. 103 // The lock protects all fields together.
99 mutable base::Lock lock_; 104 mutable base::Lock lock_;
100 105
101 DISALLOW_COPY_AND_ASSIGN(AccessUnitQueue); 106 DISALLOW_COPY_AND_ASSIGN(AccessUnitQueue);
102 }; 107 };
103 108
104 } // namespace media 109 } // namespace media
105 110
106 #endif // MEDIA_BASE_ANDROID_ACCESS_UNIT_QUEUE_H_ 111 #endif // MEDIA_BASE_ANDROID_ACCESS_UNIT_QUEUE_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/android/access_unit_queue.cc » ('j') | media/base/android/media_codec_decoder.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698