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

Side by Side Diff: content/common/gpu/media/android_video_decode_accelerator.cc

Issue 1541353002: Add offset support to BitstreamBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Handle the offset with a helper class Created 4 years, 12 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/common/gpu/media/android_video_decode_accelerator.h" 5 #include "content/common/gpu/media/android_video_decode_accelerator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 pending_bitstream_buffers_.front().first; 197 pending_bitstream_buffers_.front().first;
198 pending_bitstream_buffers_.pop(); 198 pending_bitstream_buffers_.pop();
199 TRACE_COUNTER1("media", "AVDA::PendingBitstreamBufferCount", 199 TRACE_COUNTER1("media", "AVDA::PendingBitstreamBufferCount",
200 pending_bitstream_buffers_.size()); 200 pending_bitstream_buffers_.size());
201 201
202 if (bitstream_buffer.id() == -1) { 202 if (bitstream_buffer.id() == -1) {
203 media_codec_->QueueEOS(input_buf_index); 203 media_codec_->QueueEOS(input_buf_index);
204 return; 204 return;
205 } 205 }
206 206
207 scoped_ptr<base::SharedMemory> shm( 207 scoped_ptr<SharedMemoryRegion> shm(
208 new base::SharedMemory(bitstream_buffer.handle(), true)); 208 new SharedMemoryRegion(bitstream_buffer, true));
209 RETURN_ON_FAILURE(this, shm->Map(bitstream_buffer.size()), 209 RETURN_ON_FAILURE(this, shm->Map(), "Failed to SharedMemoryRegion::Map()",
210 "Failed to SharedMemory::Map()", UNREADABLE_INPUT); 210 UNREADABLE_INPUT);
211 211
212 const base::TimeDelta presentation_timestamp = 212 const base::TimeDelta presentation_timestamp =
213 bitstream_buffer.presentation_timestamp(); 213 bitstream_buffer.presentation_timestamp();
214 DCHECK(presentation_timestamp != media::kNoTimestamp()) 214 DCHECK(presentation_timestamp != media::kNoTimestamp())
215 << "Bitstream buffers must have valid presentation timestamps"; 215 << "Bitstream buffers must have valid presentation timestamps";
216 216
217 // There may already be a bitstream buffer with this timestamp, e.g., VP9 alt 217 // There may already be a bitstream buffer with this timestamp, e.g., VP9 alt
218 // ref frames, but it's OK to overwrite it because we only expect a single 218 // ref frames, but it's OK to overwrite it because we only expect a single
219 // output frame to have that timestamp. AVDA clients only use the bitstream 219 // output frame to have that timestamp. AVDA clients only use the bitstream
220 // buffer id in the returned Pictures to map a bitstream buffer back to a 220 // buffer id in the returned Pictures to map a bitstream buffer back to a
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 // software fallback for H264 on Android anyway. 666 // software fallback for H264 on Android anyway.
667 profile.max_resolution.SetSize(3840, 2160); 667 profile.max_resolution.SetSize(3840, 2160);
668 profiles.push_back(profile); 668 profiles.push_back(profile);
669 } 669 }
670 #endif 670 #endif
671 671
672 return profiles; 672 return profiles;
673 } 673 }
674 674
675 } // namespace content 675 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698