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

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: Notified another stream after the drain completed; emulated reconfig Created 5 years, 4 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // the look-back is inclusive of the current front position). 63 // the look-back is inclusive of the current front position).
64 // If the key frame exists, sets the current access unit to it and returns 64 // If the key frame exists, sets the current access unit to it and returns
65 // true. Otherwise returns false. 65 // true. Otherwise returns false.
66 bool RewindToLastKeyFrame(); 66 bool RewindToLastKeyFrame();
67 67
68 // Returns the information about the queue. 68 // Returns the information about the queue.
69 // The result is invalidated by the following Advance() or Flush call. 69 // The result is invalidated by the following Advance() or Flush call.
70 // There must be only one |Info| consumer at a time. 70 // There must be only one |Info| consumer at a time.
71 Info GetInfo() const; 71 Info GetInfo() const;
72 72
73 // Request to emulate config changes for some key frames.
qinmin 2015/08/20 19:41:25 I don't understand this. Why is this function need
74 void EmulateConfigChanges(bool value);
75 void SetLastConfigs(const DemuxerConfigs& configs);
76
73 // For unit tests only. These methods are not thread safe. 77 // For unit tests only. These methods are not thread safe.
74 size_t NumChunksForTesting() const { return chunks_.size(); } 78 size_t NumChunksForTesting() const { return chunks_.size(); }
75 void SetHistorySizeForTesting(size_t number_of_history_chunks); 79 void SetHistorySizeForTesting(size_t number_of_history_chunks);
76 80
77 private: 81 private:
78 // Returns the amount of access units between the current one and the end, 82 // Returns the amount of access units between the current one and the end,
79 // incuding current. Logically these are units that have not been consumed. 83 // incuding current. Logically these are units that have not been consumed.
80 int GetUnconsumedAccessUnitLength() const; 84 int GetUnconsumedAccessUnitLength() const;
81 85
86 // Clone and possibly split (when we emulate configs) the incoming data chunk.
87 std::vector<DemuxerData*> CloneData(const DemuxerData& data);
88
82 // The queue of data chunks. It owns the chunks. 89 // The queue of data chunks. It owns the chunks.
83 typedef std::list<DemuxerData*> DataChunkQueue; 90 typedef std::list<DemuxerData*> DataChunkQueue;
84 DataChunkQueue chunks_; 91 DataChunkQueue chunks_;
85 92
86 // The chunk that contains the current access unit. 93 // The chunk that contains the current access unit.
87 DataChunkQueue::iterator current_chunk_; 94 DataChunkQueue::iterator current_chunk_;
88 95
89 // Index of the current access unit within the current chunk. 96 // Index of the current access unit within the current chunk.
90 size_t index_in_chunk_; 97 size_t index_in_chunk_;
91 98
92 // Amount of chunks before the |current_chunk_| that's kept for history. 99 // Amount of chunks before the |current_chunk_| that's kept for history.
93 size_t history_chunks_amount_; 100 size_t history_chunks_amount_;
94 101
95 // Indicates that a unit with End Of Stream flag has been appended. 102 // Indicates that a unit with End Of Stream flag has been appended.
96 bool has_eos_; 103 bool has_eos_;
97 104
105 // Flag to generate artificial |kConfigChanged| for some key frames.
106 bool emulate_config_changes_;
107
108 // Last config change for emulation
109 DemuxerConfigs last_configs_;
110
98 // The lock protects all fields together. 111 // The lock protects all fields together.
99 mutable base::Lock lock_; 112 mutable base::Lock lock_;
100 113
101 DISALLOW_COPY_AND_ASSIGN(AccessUnitQueue); 114 DISALLOW_COPY_AND_ASSIGN(AccessUnitQueue);
102 }; 115 };
103 116
104 } // namespace media 117 } // namespace media
105 118
106 #endif // MEDIA_BASE_ANDROID_ACCESS_UNIT_QUEUE_H_ 119 #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_video_decoder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698