mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-27 04:54:41 +08:00
[media] cx23885: Configure the MPEG encoder early to avoid jerky video
Found an odd bug while implementing support for the HVR1850 that lead to jerky video during the first capture, if the encoder was not initialized early. I've modied the driver to configure the encoder early, and this avoids the issue - a reasonable workaround. Regression tested against the HVR1800 and soon to be added HVR1850 [mchehab@redhat.com: Fix this compilation issue: drivers/media/video/cx23885/cx23885-417.c:1351:2: error: too few arguments to function ‘cx23885_initialize_codec’] Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
38e3d7ce41
commit
9c9c3d078b
@ -1044,7 +1044,7 @@ static void cx23885_codec_settings(struct cx23885_dev *dev)
|
||||
cx23885_api_cmd(dev, CX2341X_ENC_MISC, 2, 0, 4, 1);
|
||||
}
|
||||
|
||||
static int cx23885_initialize_codec(struct cx23885_dev *dev)
|
||||
static int cx23885_initialize_codec(struct cx23885_dev *dev, int startencoder)
|
||||
{
|
||||
int version;
|
||||
int retval;
|
||||
@ -1126,9 +1126,11 @@ static int cx23885_initialize_codec(struct cx23885_dev *dev)
|
||||
mc417_memory_write(dev, 2120, 0x00000080);
|
||||
|
||||
/* start capturing to the host interface */
|
||||
cx23885_api_cmd(dev, CX2341X_ENC_START_CAPTURE, 2, 0,
|
||||
CX23885_MPEG_CAPTURE, CX23885_RAW_BITS_NONE);
|
||||
msleep(10);
|
||||
if (startencoder) {
|
||||
cx23885_api_cmd(dev, CX2341X_ENC_START_CAPTURE, 2, 0,
|
||||
CX23885_MPEG_CAPTURE, CX23885_RAW_BITS_NONE);
|
||||
msleep(10);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1346,7 +1348,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
|
||||
|
||||
call_all(dev, tuner, s_frequency, f);
|
||||
|
||||
cx23885_initialize_codec(dev);
|
||||
cx23885_initialize_codec(dev, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1650,7 +1652,7 @@ static ssize_t mpeg_read(struct file *file, char __user *data,
|
||||
/* Start mpeg encoder on first read. */
|
||||
if (atomic_cmpxchg(&fh->v4l_reading, 0, 1) == 0) {
|
||||
if (atomic_inc_return(&dev->v4l_reader_count) == 1) {
|
||||
if (cx23885_initialize_codec(dev) < 0)
|
||||
if (cx23885_initialize_codec(dev, 1) < 0)
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
@ -1805,5 +1807,11 @@ int cx23885_417_register(struct cx23885_dev *dev)
|
||||
printk(KERN_INFO "%s: registered device %s [mpeg]\n",
|
||||
dev->name, video_device_node_name(dev->v4l_device));
|
||||
|
||||
/* ST: Configure the encoder paramaters, but don't begin
|
||||
* encoding, this resolves an issue where the first time the
|
||||
* encoder is started video can be choppy.
|
||||
*/
|
||||
cx23885_initialize_codec(dev, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user