A codec in the context of WebRTC (and VoIP) is a piece of software that encodes and decodes a digital stream of media.
The encode process takes raw digital data of voice or video and compresses/encodes it to make it easier to send over the network and store on digital media.
The decode process takes the encoded/compressed data and decompresses,decodes it to make it possible to play it back through a speaker or show it on a display.
In VoIP and real time communications, lossy codecs are used. These codecs reduce the information in the raw digital stream when they encode to get better compression rates at the expense of quality.
Codecs differ by the level of compression they offer, the CPU they require, the speed at which they can operate and encode a single unit of media and the patents they are bound to.
Codecs can be implemented in software, hardware or a combination of both.