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

Side by Side Diff: media/webm/webm_cluster_parser.cc

Issue 10269022: Add StreamParserBuffer to ChunkDemuxer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase ToT Created 8 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 | Annotate | Revision Log
« no previous file with comments | « media/webm/webm_cluster_parser.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/webm/webm_cluster_parser.h" 5 #include "media/webm/webm_cluster_parser.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "media/base/data_buffer.h" 8 #include "media/base/data_buffer.h"
9 #include "media/base/decrypt_config.h" 9 #include "media/base/decrypt_config.h"
10 #include "media/webm/webm_constants.h" 10 #include "media/webm/webm_constants.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 if (last_block_timecode_ != -1 && timecode < last_block_timecode_) { 108 if (last_block_timecode_ != -1 && timecode < last_block_timecode_) {
109 DVLOG(1) << "Got SimpleBlock with a timecode before the previous block."; 109 DVLOG(1) << "Got SimpleBlock with a timecode before the previous block.";
110 return false; 110 return false;
111 } 111 }
112 112
113 last_block_timecode_ = timecode; 113 last_block_timecode_ = timecode;
114 114
115 base::TimeDelta timestamp = base::TimeDelta::FromMicroseconds( 115 base::TimeDelta timestamp = base::TimeDelta::FromMicroseconds(
116 (cluster_timecode_ + timecode) * timecode_multiplier_); 116 (cluster_timecode_ + timecode) * timecode_multiplier_);
117 117
118 scoped_refptr<DataBuffer> buffer = DataBuffer::CopyFrom(data, size); 118 // The first bit of the flags is set when the block contains only keyframes.
119 // http://www.matroska.org/technical/specs/index.html
120 bool is_keyframe = (flags & 0x80) != 0;
121 scoped_refptr<StreamParserBuffer> buffer =
122 StreamParserBuffer::CopyFrom(data, size, is_keyframe);
119 123
120 if (track_num == video_track_num_ && video_encryption_key_id_.get()) { 124 if (track_num == video_track_num_ && video_encryption_key_id_.get()) {
121 buffer->SetDecryptConfig(scoped_ptr<DecryptConfig>(new DecryptConfig( 125 buffer->SetDecryptConfig(scoped_ptr<DecryptConfig>(new DecryptConfig(
122 video_encryption_key_id_.get(), video_encryption_key_id_size_))); 126 video_encryption_key_id_.get(), video_encryption_key_id_size_)));
123 } 127 }
124 128
125 buffer->SetTimestamp(timestamp); 129 buffer->SetTimestamp(timestamp);
126 BufferQueue* queue = NULL; 130 BufferQueue* queue = NULL;
127 131
128 if (track_num == audio_track_num_) { 132 if (track_num == audio_track_num_) {
(...skipping 12 matching lines...) Expand all
141 DVLOG(1) << "Got SimpleBlock timecode is not strictly monotonically " 145 DVLOG(1) << "Got SimpleBlock timecode is not strictly monotonically "
142 << "increasing for track " << track_num; 146 << "increasing for track " << track_num;
143 return false; 147 return false;
144 } 148 }
145 149
146 queue->push_back(buffer); 150 queue->push_back(buffer);
147 return true; 151 return true;
148 } 152 }
149 153
150 } // namespace media 154 } // namespace media
OLDNEW
« no previous file with comments | « media/webm/webm_cluster_parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698