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

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

Issue 185403020: Make VEA client of command buffer; move sync. IPC to VDA/VEA::Initialize() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 7da5b6ec Rebase. Created 6 years, 8 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
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 "base/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/memory_mapped_file.h" 9 #include "base/files/memory_mapped_file.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 VEAClient(const TestStream& test_stream, 242 VEAClient(const TestStream& test_stream,
243 ClientStateNotification<ClientState>* note, 243 ClientStateNotification<ClientState>* note,
244 bool save_to_file, 244 bool save_to_file,
245 unsigned int keyframe_period, 245 unsigned int keyframe_period,
246 bool force_bitrate); 246 bool force_bitrate);
247 virtual ~VEAClient(); 247 virtual ~VEAClient();
248 void CreateEncoder(); 248 void CreateEncoder();
249 void DestroyEncoder(); 249 void DestroyEncoder();
250 250
251 // VideoDecodeAccelerator::Client implementation. 251 // VideoDecodeAccelerator::Client implementation.
252 void NotifyInitializeDone() OVERRIDE;
253 void RequireBitstreamBuffers(unsigned int input_count, 252 void RequireBitstreamBuffers(unsigned int input_count,
254 const gfx::Size& input_coded_size, 253 const gfx::Size& input_coded_size,
255 size_t output_buffer_size) OVERRIDE; 254 size_t output_buffer_size) OVERRIDE;
256 void BitstreamBufferReady(int32 bitstream_buffer_id, 255 void BitstreamBufferReady(int32 bitstream_buffer_id,
257 size_t payload_size, 256 size_t payload_size,
258 bool key_frame) OVERRIDE; 257 bool key_frame) OVERRIDE;
259 void NotifyError(VideoEncodeAccelerator::Error error) OVERRIDE; 258 void NotifyError(VideoEncodeAccelerator::Error error) OVERRIDE;
260 259
261 private: 260 private:
262 bool has_encoder() { return encoder_.get(); } 261 bool has_encoder() { return encoder_.get(); }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 thread_checker_.DetachFromThread(); 385 thread_checker_.DetachFromThread();
387 } 386 }
388 387
389 VEAClient::~VEAClient() { CHECK(!has_encoder()); } 388 VEAClient::~VEAClient() { CHECK(!has_encoder()); }
390 389
391 void VEAClient::CreateEncoder() { 390 void VEAClient::CreateEncoder() {
392 DCHECK(thread_checker_.CalledOnValidThread()); 391 DCHECK(thread_checker_.CalledOnValidThread());
393 CHECK(!has_encoder()); 392 CHECK(!has_encoder());
394 393
395 encoder_.reset(new ExynosVideoEncodeAccelerator()); 394 encoder_.reset(new ExynosVideoEncodeAccelerator());
395 SetState(CS_ENCODER_SET);
396 396
397 SetState(CS_ENCODER_SET);
398 DVLOG(1) << "Profile: " << test_stream_.requested_profile 397 DVLOG(1) << "Profile: " << test_stream_.requested_profile
399 << ", requested bitrate: " << test_stream_.requested_bitrate; 398 << ", requested bitrate: " << test_stream_.requested_bitrate;
400 encoder_->Initialize(kInputFormat, 399 if (!encoder_->Initialize(kInputFormat,
401 test_stream_.size, 400 test_stream_.size,
402 test_stream_.requested_profile, 401 test_stream_.requested_profile,
403 test_stream_.requested_bitrate, 402 test_stream_.requested_bitrate,
404 this); 403 this)) {
404 DLOG(ERROR) << "VideoEncodeAccelerator::Initialize() failed";
405 SetState(CS_ERROR);
406 return;
407 }
408 SetInitialConfiguration();
409 SetState(CS_INITIALIZED);
405 } 410 }
406 411
407 void VEAClient::DestroyEncoder() { 412 void VEAClient::DestroyEncoder() {
408 DCHECK(thread_checker_.CalledOnValidThread()); 413 DCHECK(thread_checker_.CalledOnValidThread());
409 if (!has_encoder()) 414 if (!has_encoder())
410 return; 415 return;
411 encoder_.release()->Destroy(); 416 encoder_.release()->Destroy();
412 } 417 }
413 418
414 void VEAClient::NotifyInitializeDone() {
415 DCHECK(thread_checker_.CalledOnValidThread());
416 SetInitialConfiguration();
417 SetState(CS_INITIALIZED);
418 }
419
420 void VEAClient::RequireBitstreamBuffers(unsigned int input_count, 419 void VEAClient::RequireBitstreamBuffers(unsigned int input_count,
421 const gfx::Size& input_coded_size, 420 const gfx::Size& input_coded_size,
422 size_t output_size) { 421 size_t output_size) {
423 DCHECK(thread_checker_.CalledOnValidThread()); 422 DCHECK(thread_checker_.CalledOnValidThread());
424 ASSERT_EQ(state_, CS_INITIALIZED); 423 ASSERT_EQ(state_, CS_INITIALIZED);
425 SetState(CS_ENCODING); 424 SetState(CS_ENCODING);
426 425
427 // TODO(posciak): For now we only support input streams that meet encoder 426 // TODO(posciak): For now we only support input streams that meet encoder
428 // size requirements exactly (i.e. coded size == visible size). 427 // size requirements exactly (i.e. coded size == visible size).
429 input_coded_size_ = input_coded_size; 428 input_coded_size_ = input_coded_size;
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 } 761 }
763 if (it->first == "v" || it->first == "vmodule") 762 if (it->first == "v" || it->first == "vmodule")
764 continue; 763 continue;
765 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; 764 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second;
766 } 765 }
767 766
768 base::ShadowingAtExitManager at_exit_manager; 767 base::ShadowingAtExitManager at_exit_manager;
769 768
770 return RUN_ALL_TESTS(); 769 return RUN_ALL_TESTS();
771 } 770 }
OLDNEW
« no previous file with comments | « content/common/gpu/media/video_decode_accelerator_unittest.cc ('k') | content/renderer/media/pepper_platform_video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698