Packet size is one of the most important factors that would affect the user-perceived multimedia QoS in the wireless LAN environments. The time-varying channel characteristics make it difficult to find the exact relationship between the packet size and the throughput and decide an optimal packet size in advance. Furthermore, every node would suffer different channel conditions. In this paper, we tackle this problem by an optimization approach. A context-aware framework is designed to optimize the packet size adaptively in order to maximize the throughput. In this approach each node abstracts its specific context via the throughput from the time-varying wireless environments. The obtained throughput information is the instantaneous integrated effect of all contexts in wireless LAN environments. This approach adopts neural networks to learn the complex nonlinear function between the packet size and the throughput and adaptively adjusts the packet size. Simulation results show that out method can cope with the time-varying wireless channel conditions and improve the perceived QoS of wireless multimedia services.