| OLD | NEW | 
|    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 // This file contains an implementation of VideoDecodeAccelerator |    5 // This file contains an implementation of VideoDecodeAccelerator | 
|    6 // that utilizes hardware video decoders, which expose Video4Linux 2 API |    6 // that utilizes hardware video decoders, which expose Video4Linux 2 API | 
|    7 // (http://linuxtv.org/downloads/v4l-dvb-apis/). |    7 // (http://linuxtv.org/downloads/v4l-dvb-apis/). | 
|    8  |    8  | 
|    9 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ |    9 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ | 
|   10 #define CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ |   10 #define CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ | 
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  268   // |  268   // | 
|  269   // Other utility functions.  Called on decoder_thread_, unless |  269   // Other utility functions.  Called on decoder_thread_, unless | 
|  270   // decoder_thread_ is not yet started, in which case the child thread can call |  270   // decoder_thread_ is not yet started, in which case the child thread can call | 
|  271   // these (e.g. in Initialize() or Destroy()). |  271   // these (e.g. in Initialize() or Destroy()). | 
|  272   // |  272   // | 
|  273  |  273  | 
|  274   // Create the buffers we need. |  274   // Create the buffers we need. | 
|  275   bool CreateInputBuffers(); |  275   bool CreateInputBuffers(); | 
|  276   bool CreateOutputBuffers(); |  276   bool CreateOutputBuffers(); | 
|  277  |  277  | 
|  278   // Set input and output formats before starting decode. |  | 
|  279   bool SetupFormats(); |  | 
|  280  |  | 
|  281   // |  278   // | 
|  282   // Methods run on child thread. |  279   // Methods run on child thread. | 
|  283   // |  280   // | 
|  284  |  281  | 
|  285   // Destroy buffers. |  282   // Destroy buffers. | 
|  286   void DestroyInputBuffers(); |  283   void DestroyInputBuffers(); | 
|  287   // In contrast to DestroyInputBuffers, which is called only from destructor, |  284   // In contrast to DestroyInputBuffers, which is called only from destructor, | 
|  288   // we call DestroyOutputBuffers also during playback, on resolution change. |  285   // we call DestroyOutputBuffers also during playback, on resolution change. | 
|  289   // Even if anything fails along the way, we still want to go on and clean |  286   // Even if anything fails along the way, we still want to go on and clean | 
|  290   // up as much as possible, so return false if this happens, so that the |  287   // up as much as possible, so return false if this happens, so that the | 
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  394   bool output_streamon_; |  391   bool output_streamon_; | 
|  395   // Output buffers enqueued to device. |  392   // Output buffers enqueued to device. | 
|  396   int output_buffer_queued_count_; |  393   int output_buffer_queued_count_; | 
|  397   // Output buffers ready to use, as a FIFO since we want oldest-first to hide |  394   // Output buffers ready to use, as a FIFO since we want oldest-first to hide | 
|  398   // synchronization latency with GL. |  395   // synchronization latency with GL. | 
|  399   std::queue<int> free_output_buffers_; |  396   std::queue<int> free_output_buffers_; | 
|  400   // Mapping of int index to output buffer record. |  397   // Mapping of int index to output buffer record. | 
|  401   std::vector<OutputRecord> output_buffer_map_; |  398   std::vector<OutputRecord> output_buffer_map_; | 
|  402   // Required size of DPB for decoding. |  399   // Required size of DPB for decoding. | 
|  403   int output_dpb_size_; |  400   int output_dpb_size_; | 
|  404  |  401   // Stores the number of planes (i.e. separate memory buffers) for output. | 
|  405   // Number of planes (i.e. separate memory buffers) for output. |  | 
|  406   size_t output_planes_count_; |  402   size_t output_planes_count_; | 
|  407  |  403  | 
|  408   // Pictures that are ready but not sent to PictureReady yet. |  404   // Pictures that are ready but not sent to PictureReady yet. | 
|  409   std::queue<PictureRecord> pending_picture_ready_; |  405   std::queue<PictureRecord> pending_picture_ready_; | 
|  410  |  406  | 
|  411   // The number of pictures that are sent to PictureReady and will be cleared. |  407   // The number of pictures that are sent to PictureReady and will be cleared. | 
|  412   int picture_clearing_count_; |  408   int picture_clearing_count_; | 
|  413  |  409  | 
|  414   // Used by the decoder thread to wait for AssignPictureBuffers to arrive |  410   // Used by the decoder thread to wait for AssignPictureBuffers to arrive | 
|  415   // to avoid races with potential Reset requests. |  411   // to avoid races with potential Reset requests. | 
| (...skipping 15 matching lines...) Expand all  Loading... | 
|  431  |  427  | 
|  432   // Make our context current before running any EGL entry points. |  428   // Make our context current before running any EGL entry points. | 
|  433   base::Callback<bool(void)> make_context_current_; |  429   base::Callback<bool(void)> make_context_current_; | 
|  434  |  430  | 
|  435   // EGL state |  431   // EGL state | 
|  436   EGLDisplay egl_display_; |  432   EGLDisplay egl_display_; | 
|  437   EGLContext egl_context_; |  433   EGLContext egl_context_; | 
|  438  |  434  | 
|  439   // The codec we'll be decoding for. |  435   // The codec we'll be decoding for. | 
|  440   media::VideoCodecProfile video_profile_; |  436   media::VideoCodecProfile video_profile_; | 
|  441   // Chosen output format. |  | 
|  442   uint32_t output_format_fourcc_; |  | 
|  443  |  437  | 
|  444   // The WeakPtrFactory for |weak_this_|. |  438   // The WeakPtrFactory for |weak_this_|. | 
|  445   base::WeakPtrFactory<V4L2VideoDecodeAccelerator> weak_this_factory_; |  439   base::WeakPtrFactory<V4L2VideoDecodeAccelerator> weak_this_factory_; | 
|  446  |  440  | 
|  447   DISALLOW_COPY_AND_ASSIGN(V4L2VideoDecodeAccelerator); |  441   DISALLOW_COPY_AND_ASSIGN(V4L2VideoDecodeAccelerator); | 
|  448 }; |  442 }; | 
|  449  |  443  | 
|  450 }  // namespace content |  444 }  // namespace content | 
|  451  |  445  | 
|  452 #endif  // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ |  446 #endif  // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ | 
| OLD | NEW |