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

Side by Side Diff: content/common/gpu/media/android_video_encode_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, 11 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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_encode_accelerator.h" 5 #include "content/common/gpu/media/android_video_encode_accelerator.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 break; 421 break;
422 422
423 default: 423 default:
424 NOTREACHED(); 424 NOTREACHED();
425 break; 425 break;
426 } 426 }
427 } while (buf_index < 0); 427 } while (buf_index < 0);
428 428
429 media::BitstreamBuffer bitstream_buffer = available_bitstream_buffers_.back(); 429 media::BitstreamBuffer bitstream_buffer = available_bitstream_buffers_.back();
430 available_bitstream_buffers_.pop_back(); 430 available_bitstream_buffers_.pop_back();
431 scoped_ptr<base::SharedMemory> shm( 431 scoped_ptr<SharedMemoryRegion> shm(
432 new base::SharedMemory(bitstream_buffer.handle(), false)); 432 new SharedMemoryRegion(bitstream_buffer, false));
433 RETURN_ON_FAILURE(shm->Map(bitstream_buffer.size()), 433 RETURN_ON_FAILURE(shm->Map(), "Failed to map SHM", kPlatformFailureError);
434 "Failed to map SHM",
435 kPlatformFailureError);
436 RETURN_ON_FAILURE(size <= shm->mapped_size(), 434 RETURN_ON_FAILURE(size <= shm->mapped_size(),
437 "Encoded buffer too large: " << size << ">" 435 "Encoded buffer too large: " << size << ">"
438 << shm->mapped_size(), 436 << shm->mapped_size(),
439 kPlatformFailureError); 437 kPlatformFailureError);
440 438
441 media_codec_->CopyFromOutputBuffer(buf_index, offset, shm->memory(), size); 439 media_codec_->CopyFromOutputBuffer(buf_index, offset, shm->memory(), size);
442 media_codec_->ReleaseOutputBuffer(buf_index, false); 440 media_codec_->ReleaseOutputBuffer(buf_index, false);
443 --num_buffers_at_codec_; 441 --num_buffers_at_codec_;
444 442
445 UMA_HISTOGRAM_COUNTS_10000("Media.AVEA.EncodedBufferSizeKB", size / 1024); 443 UMA_HISTOGRAM_COUNTS_10000("Media.AVEA.EncodedBufferSizeKB", size / 1024);
446 base::MessageLoop::current()->PostTask( 444 base::MessageLoop::current()->PostTask(
447 FROM_HERE, 445 FROM_HERE,
448 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady, 446 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady,
449 client_ptr_factory_->GetWeakPtr(), 447 client_ptr_factory_->GetWeakPtr(),
450 bitstream_buffer.id(), 448 bitstream_buffer.id(),
451 size, 449 size,
452 key_frame)); 450 key_frame));
453 } 451 }
454 452
455 } // namespace content 453 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698