Skip to content

Commit 21e636e

Browse files
Hans VerkuilJiri Slaby
authored andcommitted
media: hdpvr: fix two audio bugs
commit 3445857 upstream. When the audio encoding is changed the driver calls hdpvr_set_audio with the current opt->audio_input value. However, that should have been opt->audio_input + 1. So changing the audio encoding inadvertently changes the input as well. This bug has always been there. The second bug was introduced in kernel 3.10 and that broke the default_audio_input module option handling: the audio encoding was never switched to AC3 if default_audio_input was set to 2 (SPDIF input). In addition, since starting with 3.10 the audio encoding is always set at the start the first bug now always happens when the driver is loaded. In the past this bug would only surface if the user would change the audio encoding after the driver was loaded. Also fixes a small trivial typo (bufffer -> buffer). Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reported-by: Scott Doty <scott@corp.sonic.net> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
1 parent 7da8f9a commit 21e636e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎drivers/media/usb/hdpvr/hdpvr-video.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static void hdpvr_read_bulk_callback(struct urb *urb)
8282
}
8383

8484
/*=========================================================================*/
85-
/* bufffer bits */
85+
/* buffer bits */
8686

8787
/* function expects dev->io_mutex to be hold by caller */
8888
int hdpvr_cancel_queue(struct hdpvr_device *dev)
@@ -926,7 +926,7 @@ static int hdpvr_s_ctrl(struct v4l2_ctrl *ctrl)
926926
case V4L2_CID_MPEG_AUDIO_ENCODING:
927927
if (dev->flags & HDPVR_FLAG_AC3_CAP) {
928928
opt->audio_codec = ctrl->val;
929-
return hdpvr_set_audio(dev, opt->audio_input,
929+
return hdpvr_set_audio(dev, opt->audio_input + 1,
930930
opt->audio_codec);
931931
}
932932
return 0;
@@ -1198,7 +1198,7 @@ int hdpvr_register_videodev(struct hdpvr_device *dev, struct device *parent,
11981198
v4l2_ctrl_new_std_menu(hdl, &hdpvr_ctrl_ops,
11991199
V4L2_CID_MPEG_AUDIO_ENCODING,
12001200
ac3 ? V4L2_MPEG_AUDIO_ENCODING_AC3 : V4L2_MPEG_AUDIO_ENCODING_AAC,
1201-
0x7, V4L2_MPEG_AUDIO_ENCODING_AAC);
1201+
0x7, ac3 ? dev->options.audio_codec : V4L2_MPEG_AUDIO_ENCODING_AAC);
12021202
v4l2_ctrl_new_std_menu(hdl, &hdpvr_ctrl_ops,
12031203
V4L2_CID_MPEG_VIDEO_ENCODING,
12041204
V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC, 0x3,

0 commit comments

Comments
 (0)