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

Side by Side Diff: remoting/client/plugin/pepper_video_renderer_3d.cc

Issue 2692383002: CRD Webapp intermittently crashes on some machines (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "remoting/client/plugin/pepper_video_renderer_3d.h" 5 #include "remoting/client/plugin/pepper_video_renderer_3d.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 pending_frames_.front()->OnDecoded(); 326 pending_frames_.front()->OnDecoded();
327 // Move the frame from |pending_frames_| to |decoded_frames_|. 327 // Move the frame from |pending_frames_| to |decoded_frames_|.
328 decoded_frames_.splice(decoded_frames_.end(), pending_frames_, 328 decoded_frames_.splice(decoded_frames_.end(), pending_frames_,
329 pending_frames_.begin()); 329 pending_frames_.begin());
330 330
331 DecodeNextPacket(); 331 DecodeNextPacket();
332 GetNextPicture(); 332 GetNextPicture();
333 } 333 }
334 334
335 void PepperVideoRenderer3D::GetNextPicture() { 335 void PepperVideoRenderer3D::GetNextPicture() {
336 if (get_picture_pending_) 336 // Return early if |decoded_frames_| is empty or the decoder is already
337 // preparing a picture. If we call GetPicture() before a new frame has been
338 // prepared (i.e. |decoded_frames_| is populated), the OnPictureReady callback
339 // could be called before OnDecodeDone() is called which will cause a crash.
340 // See crbug.com/689229 for more details.
341 if (get_picture_pending_ || decoded_frames_.empty()) {
337 return; 342 return;
343 }
338 344
339 int32_t result = 345 int32_t result =
340 video_decoder_.GetPicture(callback_factory_.NewCallbackWithOutput( 346 video_decoder_.GetPicture(callback_factory_.NewCallbackWithOutput(
341 &PepperVideoRenderer3D::OnPictureReady)); 347 &PepperVideoRenderer3D::OnPictureReady));
342 CHECK_EQ(result, PP_OK_COMPLETIONPENDING); 348 CHECK_EQ(result, PP_OK_COMPLETIONPENDING);
343 get_picture_pending_ = true; 349 get_picture_pending_ = true;
344 } 350 }
345 351
346 void PepperVideoRenderer3D::OnPictureReady(int32_t result, 352 void PepperVideoRenderer3D::OnPictureReady(int32_t result,
347 PP_VideoPicture picture) { 353 PP_VideoPicture picture) {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 gles2_if_->AttachShader(graphics_.pp_resource(), shader_program_, shader); 579 gles2_if_->AttachShader(graphics_.pp_resource(), shader_program_, shader);
574 gles2_if_->DeleteShader(graphics_.pp_resource(), shader); 580 gles2_if_->DeleteShader(graphics_.pp_resource(), shader);
575 } 581 }
576 582
577 void PepperVideoRenderer3D::CheckGLError() { 583 void PepperVideoRenderer3D::CheckGLError() {
578 GLenum error = gles2_if_->GetError(graphics_.pp_resource()); 584 GLenum error = gles2_if_->GetError(graphics_.pp_resource());
579 CHECK_EQ(error, static_cast<GLenum>(GL_NO_ERROR)) << "GL error: " << error; 585 CHECK_EQ(error, static_cast<GLenum>(GL_NO_ERROR)) << "GL error: " << error;
580 } 586 }
581 587
582 } // namespace remoting 588 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698