diff options
author | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-15 17:09:18 +0000 |
---|---|---|
committer | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-15 17:09:18 +0000 |
commit | ce2d72c6918e9707ef3dc9987369241108ed239f (patch) | |
tree | e6cd9b58cebe325676fae66b65921282c652b2ab /ppapi/examples/gles2 | |
parent | e849792e6b65f2d495934633cc918dccfacdda5a (diff) | |
download | chromium_src-ce2d72c6918e9707ef3dc9987369241108ed239f.zip chromium_src-ce2d72c6918e9707ef3dc9987369241108ed239f.tar.gz chromium_src-ce2d72c6918e9707ef3dc9987369241108ed239f.tar.bz2 |
Enable fire-and-forget Destroy of HW video decoder, and misc other improvements.
- Instead of requiring the client to wait for NotifyDestroyDone
we do the asynchronous OMX teardown dance on the client's
behalf.
- Prettify/simplify error handling in OVDA for easier matching of
errors to OMX_Core.h and to remove redundant information.
- Enable previously-DISABLED_ early-teardown unittests!
- Remove passing VideoDecoder_Dev object in PPP_VideoDecoder_Dev
calls, because it was unnecssary, and because the
~VideoDecoder_Dev dtor is now not a no-op so we don't want to
call it spuriously.
- Remove accidentally re-added
gpu_video_service_host.cc (originally removed in 92251,
accidentally reintroduced by a bad rebase in 92383).
BUG=none
TEST=ovdatest passes (incl. early-teardown tests) and gles2 works (including reload and EOS handling, no crashes)
Review URL: http://codereview.chromium.org/7361010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92704 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/examples/gles2')
-rw-r--r-- | ppapi/examples/gles2/gles2.cc | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/ppapi/examples/gles2/gles2.cc b/ppapi/examples/gles2/gles2.cc index 60c5bdf..a7e076e 100644 --- a/ppapi/examples/gles2/gles2.cc +++ b/ppapi/examples/gles2/gles2.cc @@ -58,15 +58,12 @@ class GLES2DemoInstance : public pp::Instance, public pp::Graphics3DClient_Dev, // pp::VideoDecoderClient_Dev implementation. virtual void ProvidePictureBuffers( - pp::VideoDecoder_Dev decoder, uint32_t req_num_of_bufs, - PP_Size dimensions, PP_PictureBufferType_Dev type); - virtual void DismissPictureBuffer( - pp::VideoDecoder_Dev decoder, int32_t picture_buffer_id); - virtual void PictureReady( - pp::VideoDecoder_Dev decoder, const PP_Picture_Dev& picture); - virtual void EndOfStream(pp::VideoDecoder_Dev decoder); - virtual void NotifyError( - pp::VideoDecoder_Dev decoder, PP_VideoDecodeError_Dev error); + uint32_t req_num_of_bufs, PP_Size dimensions, + PP_PictureBufferType_Dev type); + virtual void DismissPictureBuffer(int32_t picture_buffer_id); + virtual void PictureReady(const PP_Picture_Dev& picture); + virtual void EndOfStream(); + virtual void NotifyError(PP_VideoDecodeError_Dev error); private: enum { kNumConcurrentDecodes = 7 }; @@ -78,7 +75,6 @@ class GLES2DemoInstance : public pp::Instance, public pp::Graphics3DClient_Dev, void DecoderInitDone(int32_t result); void DecoderBitstreamDone(int32_t result, int bitstream_buffer_id); void DecoderFlushDone(int32_t result); - void DecoderAbortDone(int32_t result); // Decode helpers. void DecodeNextNALUs(); @@ -146,7 +142,7 @@ GLES2DemoInstance::GLES2DemoInstance(PP_Instance instance, pp::Module* module) } GLES2DemoInstance::~GLES2DemoInstance() { - delete video_decoder_; + delete video_decoder_; // May be NULL, which is fine. delete surface_; delete context_; } @@ -194,9 +190,8 @@ void GLES2DemoInstance::DecoderFlushDone(int32_t result) { // Check that each bitstream buffer ID we handed to the decoder got handed // back to us. assert(bitstream_ids_at_decoder_.empty()); -} - -void GLES2DemoInstance::DecoderAbortDone(int32_t result) { + delete video_decoder_; + video_decoder_ = NULL; } static bool LookingAtNAL(const unsigned char* encoded, size_t pos) { @@ -256,7 +251,7 @@ void GLES2DemoInstance::DecodeNextNALU() { } void GLES2DemoInstance::ProvidePictureBuffers( - pp::VideoDecoder_Dev decoder, uint32_t req_num_of_bufs, PP_Size dimensions, + uint32_t req_num_of_bufs, PP_Size dimensions, PP_PictureBufferType_Dev type) { std::vector<PP_GLESBuffer_Dev> buffers; for (uint32_t i = 0; i < req_num_of_bufs; i++) { @@ -270,16 +265,14 @@ void GLES2DemoInstance::ProvidePictureBuffers( video_decoder_->AssignGLESBuffers(buffers); } -void GLES2DemoInstance::DismissPictureBuffer( - pp::VideoDecoder_Dev decoder, int32_t picture_buffer_id) { +void GLES2DemoInstance::DismissPictureBuffer(int32_t picture_buffer_id) { PictureBufferMap::iterator it = buffers_by_id_.find(picture_buffer_id); assert(it != buffers_by_id_.end()); DeleteTexture(it->second.texture_id); buffers_by_id_.erase(it); } -void GLES2DemoInstance::PictureReady( - pp::VideoDecoder_Dev decoder, const PP_Picture_Dev& picture) { +void GLES2DemoInstance::PictureReady(const PP_Picture_Dev& picture) { if (first_frame_delivered_ticks_ == -1) assert((first_frame_delivered_ticks_ = core_if_->GetTimeTicks()) != -1); if (is_painting_) { @@ -292,11 +285,10 @@ void GLES2DemoInstance::PictureReady( Render(it->second); } -void GLES2DemoInstance::EndOfStream(pp::VideoDecoder_Dev decoder) { +void GLES2DemoInstance::EndOfStream() { } -void GLES2DemoInstance::NotifyError( - pp::VideoDecoder_Dev decoder, PP_VideoDecodeError_Dev error) { +void GLES2DemoInstance::NotifyError(PP_VideoDecodeError_Dev error) { } // This object is the global object representing this plugin library as long @@ -366,11 +358,12 @@ void GLES2DemoInstance::PaintFinished(int32_t result, int picture_buffer_id) { << fps << ", with average ms/swap of: " << ms_per_swap << std::endl; } - video_decoder_->ReusePictureBuffer(picture_buffer_id); + if (video_decoder_) + video_decoder_->ReusePictureBuffer(picture_buffer_id); while (!pictures_pending_paint_.empty() && !is_painting_) { PP_Picture_Dev picture = pictures_pending_paint_.front(); pictures_pending_paint_.pop_front(); - PictureReady(*video_decoder_, picture); + PictureReady(picture); } } |