Commit Graph

88 Commits

Author SHA1 Message Date
Chih-Chung Chang
ac2a934aae am 7df74471: Merge "Flush binder buffer after setting raw heap to avoid leaking a reference." into froyo
Merge commit '7df7447112371fb5e46f6084b55ac2ccdfde139d' into gingerbread

* commit '7df7447112371fb5e46f6084b55ac2ccdfde139d':
  Flush binder buffer after setting raw heap to avoid leaking a reference.
2010-07-02 07:48:03 -07:00
Chih-Chung Chang
b6aef253f4 Flush binder buffer after setting raw heap to avoid leaking a reference.
The problem was:

1. In handleShutter(), thread A in CameraService calls
   registerBuffers(IMemoryHeap) and it's received by thread B
   in system_server. [transaction 1]
2. While thread A is waiting for the reply, thread B calls
   back to thread A to get the id of the heap
   (IMemoryHeap.getHeapID). [transaction 2]
3. Thread A replies transaction 2 and is preemptied in kernel.
   Thread B gets the reply and finishes registerBuffers and send
   reply for transaction 1.
4. When thread A runs again, it gets the reply for transaction 1
   and returns to handleShutter().
5. At this point the transaction buffer for transaction 2 (which
   holds a reference to IMemoryHeap) is not freed because the
   BC_FREE_BUFFER command is kept in thread A's local command
   queue and not sent to the kernel.
6. Normally when thread A makes next transaction, the
   BC_FREE_BUFFER command will be sent together (piggyback) with
   the commands for that transaction. But in this case thread A
   is a callback thread from camera driver, so it does not make
   any binder calls afterwards, and the IMemoryHeap is never freed
   (until the next time handleShutter is called).

Change-Id: I435a258187509bdbbaf353339eb9ea577610cbd2
2010-07-02 12:56:54 +08:00
Chih-Chung Chang
189aab1390 Change camera interface to support multiple cameras.
Change-Id: Ie88fe706d2278acf762eca87780de349434778a4
2010-06-11 16:47:33 +08:00
James Dong
fcd193c9fd Remove the lock/unlock workaround from CameraService
bug - 2677772

Change-Id: I7c996daad8b3bfc89e9fa2d655dc18c9a5c68f2f
2010-06-09 21:30:43 -07:00
Chih-Chung Chang
6697ed5d4e Merge "Disable CameraServiceTest in a normal build." into kraken 2010-05-23 21:04:01 -07:00
Nick Kralevich
e8de8f47c6 Forgot to fix one -Wformat-security in my previous change. Fixed.
Change-Id: Ice7459b30e1d7dbfe400b68d27ebc04fcca78bae
2010-05-14 10:29:13 -07:00
Nick Kralevich
df325c5325 Get rid of warnings when compiled with -Wformat-security
Change-Id: Ibd814d894ff0eba26b01932b9865098b7bb26f95
2010-05-14 09:06:55 -07:00
Chih-Chung Chang
907c18afc6 Disable CameraServiceTest in a normal build.
Change-Id: I18dfcb073e6a8e72ad35f47d6884f5f2f62d3dca
2010-05-14 15:45:10 +08:00
Mathias Agopian
673b56b41f another attempt at fixing the build
Change-Id: I80b498d1bbb8f9ffcec4f27802be7ae9977f70ac
2010-05-12 18:37:43 -07:00
Chih-Chung Chang
2ff1971b68 Force sooner/generic/sim to use camera stub only.
Change-Id: Ie3251e3801cd09b3f373bbd4afb5fda82a0c5818
2010-05-10 15:04:40 +08:00
Chih-Chung Chang
8476185a96 Fix for build without a hardware camera.
Change-Id: Ib5a0b58ea9e02ae1df9d258de541726189147567
2010-05-10 14:36:24 +08:00
Chih-Chung Chang
5997faf931 Support multiple cameras in framework.
Change-Id: I081f0fbdca4b633715ea7c3b3d42f8662d27598a
2010-05-10 11:21:14 +08:00
James Dong
f06bb989d6 Use timestamp from camera driver for CameraSource
Change-Id: I09ddec69997c43b8f17fdd21304c76cb4c5ab8cf
2010-04-28 11:55:47 -07:00
Chih-Chung Chang
f0252f278b Still do dump() if we cannot get mServiceLock for a while. 2010-03-05 15:21:02 -08:00
Chih-Chung Chang
9cb6df5697 Fix the rgb to yuv422sp conversion. The order of uv is different from the
original version, but it should be ok as the original Y,Cb,Cr are all incorrect.
2010-02-18 14:02:56 -08:00
Mathias Agopian
29d174255d fix [2447659] fix improper usage of the YCbCr_420_SP format 2010-02-16 20:45:21 -08:00
Mathias Agopian
54ed4f6282 get rid off the YUV formats at the libui layer 2010-02-16 17:33:37 -08:00
Mathias Agopian
9cce325fae split libsurfaceflinger_client and libcamera_client out of libui 2010-02-11 13:16:22 -08:00
Andreas Huber
d4461e7664 API Extension: Support for optionally specifying a map of extra request headers when specifying the uri of media data to be played.
related-to-bug: 2393577

Original change by Andrei Popescu <andreip@google.com>
2010-01-28 11:52:43 -08:00
Chih-Chung Chang
f091e833d3 Add support for setting camera display orientation. 2010-01-26 11:07:07 -08:00
Chih-Chung Chang
52e7200b6e Add an orientation parameter for overlay, so we can do camera preview in portrait mode. 2010-01-21 20:20:08 -08:00
Joe Onorato
51632e800a less log spew 2010-01-08 15:46:24 -05:00
Dave Sparks
e7e93f9326 Remove some logging from camera operations. Bug 2346606. 2010-01-04 08:55:04 -08:00
Doug Kwan
44b28d9e7b Add missing library in linker option. Currently the library is used by the
executable but not specified.  It is included via dependency of another shared
object.
2009-12-09 16:32:04 -08:00
Android (Google) Code Review
abb64629e2 Merge change I5ff64f6f into eclair-mr2
* changes:
  Add CameraServiceTest.
2009-12-02 02:48:40 -08:00
Eric Laurent
811f2943a7 am bb3bb57a: Merge change I524dc046 into eclair
Merge commit 'bb3bb57a6330f71323fcd7e93e88dbdab55daec3' into eclair-mr2

* commit 'bb3bb57a6330f71323fcd7e93e88dbdab55daec3':
  Fix issue 2192673: Music Pausing Even when notifications are set to silent.
2009-12-01 17:04:24 -08:00
Eric Laurent
059b413e65 Fix issue 2192673: Music Pausing Even when notifications are set to silent.
Do not play ringtones, notifications or camera sounds if ringer mode is silent.
2009-11-27 05:07:55 -08:00
Owen Lin
7371ed684e Set more camera parameters initial values.
We will need those values for new camera framework. And change the canned jpeg
image to match the new width and height setting.

Change-Id: I49f8fb63d2b859b9e9f1c5d27657a10203315bb6
2009-11-27 12:52:32 +08:00
Chih-Chung Chang
799ae618c5 Add CameraServiceTest. 2009-11-13 12:50:58 +08:00
Dave Sparks
ff0f38e6fe Fix potential deadlock in stopPreview/stopRecord.
Some camera HALs spin up a preview thread and need to wait for
the thread to exit. This can create a potential deadlock. In
stopPreview, we take the main lock. If a preview callback occurs
while the lock is held, the preview thread will block. If the
camera HAL is waiting for the preview thread to exit, this will
cause a deadlock.

This patch breaks out the preview buffer heap into a separate
mutex. This mutex is never held when the main lock is held, thus
preventing the deadlock from occuring.
2009-11-10 17:08:08 -08:00
Dave Sparks
23c21baf27 Hold a lock while we access the preview heap.
copyFrameAndPostCopiedFrame was not holding a lock while it accessed
the preview heap. If the client process is torn down while the heap
is accessed, the memcpy could access memory that was deallocated.

This patch creates a local sp reference to the preview heap while
holding the lock, then releases the lock. This should prevent the
heap from being pulled out from underneath us.
2009-11-06 11:47:13 -08:00
Wu-cheng Li
986e0dcf7a Use image rect information to display zoomed picture. 2009-10-29 13:20:26 +08:00
Dave Sparks
393eb7967f Don't callback on NULL client. Bug 2180510.
We weren't checking to see if there was a valid camera client when
calling the notify callback function. Now we grab a strong pointer
before the callback to guarantee that the client is not destroyed
before we complete the callback. This change also fixes other
places in the code where we weren't holding a local strong pointer.
2009-10-15 15:18:08 -07:00
Dave Sparks
587f7830a1 Retry overlay create if it fails. Bug 2153980.
Occasionally we see references to the overlay hanging around long
enough to cause problems in applications when they tried to destroy
the overlay and re-create it. This patch causes the camera HAL to
retry the overlay creation call if it fails every 20ms up to 50
times before it gives up.
2009-10-07 19:22:02 -07:00
Wu-cheng Li
e6a550d02f Add zoom functions and sendCommand.
b2060030
2009-10-06 13:25:10 -07:00
Chih-Chung Chang
00900eb354 Fix 2083478: Camera needs an auto-focus cancel API
Change-Id: I13bda991b32aee47e82b5cf9d43b3021c416a9a2
2009-09-15 18:29:03 +08:00
James Dong
102f777f2c Pass return code from Camera HAL for setParameters().
bug 2116866
2009-09-13 17:12:35 -07:00
Snigdha Sinha
d77818614e CameraService change for OVERLAY_FORMAT_DEFAULT
Originally from: https://partner.source.android.com/g/#change,829
2009-09-08 18:28:15 -07:00
Benny Wong
4c8fb0a184 Modified the camera HAL interface to use the same generic callback architecture as camera services 2009-08-13 10:46:28 -07:00
Marco Nelissen
7907df75e0 In the simulator, make sure that the preview thread is a Java thread,
since we won't be going through the binder in single process mode.
2009-08-13 09:24:47 -07:00
Eric Laurent
9d91ad5d99 Fix issue 1795088 Improve audio routing code
Initial commit for review.
Integrated comments after patch set 1 review.
Fixed lockup in AudioFlinger::ThreadBase::exit()
Fixed lockup when playing tone with AudioPlocyService startTone()
2009-07-23 06:03:39 -07:00
Benny Wong
71f771570e Hardware overlay support
Enable hardware overlay support for camera and video playback use cases
2009-07-16 14:31:20 -07:00
Dave Sparks
9f1234e460 resolved conflicts for merge of 04c7d0f8 to master 2009-07-08 17:26:05 -07:00
Dave Sparks
f72d640b7c Add timestamps to video frames to improve A/V sync.
Bug 1927069.
2009-07-08 15:59:25 -07:00
Wu-cheng Li
cd998742c3 am b8a10fe4: Allow setPreviewDisplay after startPreview.
Merge commit 'b8a10fe45657f2dcc50cae8a06805f8438a6937e'

* commit 'b8a10fe45657f2dcc50cae8a06805f8438a6937e':
  Allow setPreviewDisplay after startPreview.
2009-07-01 11:20:08 -07:00
Wu-cheng Li
988fb62884 Allow setPreviewDisplay after startPreview. 2009-07-01 01:41:25 +08:00
Android (Google) Code Review
8da70e8049 am c6a482e7: Merge change 5199 into donut
Merge commit 'c6a482e778e7b5fc5790edf22e554c93f53b1112'

* commit 'c6a482e778e7b5fc5790edf22e554c93f53b1112':
  Only remove client after the hardware is teared down, so a new client
2009-06-24 20:34:35 -07:00
Chih-Chung Chang
d2d6bc7552 Only remove client after the hardware is teared down, so a new client
is rejected before old client is done.

Also check mUsers in all cases to make sure there are no existing client.
2009-06-25 11:03:55 +08:00
Android (Google) Code Review
327adb8fec am 82a32714: Merge change 5190 into donut
Merge commit '82a32714f07d25259b91163d383ccdb74a166d2d'

* commit '82a32714f07d25259b91163d383ccdb74a166d2d':
  Fix 1933269: startPreview failed.
2009-06-24 13:53:24 -07:00
Chih-Chung Chang
fa89f9f897 Fix 1933269: startPreview failed.
The reason we need this count is a new CameraService::connect() request may
come in while the previous Client's destructor has not been run or is still
running. If the last strong reference of the previous Client is gone but
destructor has not been run, we should not allow the new Client to be created
because we need to wait for the previous Client to tear down the hardware
first.
2009-06-24 15:50:57 +08:00