Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Kernel OOPS



Hi, 

i am playing around with the DVR device for playing back a TS which was recorded from the DVR device.

Basic of Hardware:
P4C800 Deluxe with P4 FSB 800 3 GHz HT
2 GB Ram
WIN-TV DVB-S PCI

Kernel 2.6.3 vanilla

The kernel is configured a an SMP Kernel and Preemptible feature.

I checked this oops also on Kernel 2.6.4-rc1 and Kernel 2.6.4-rc1 mm2

If i leave the Preemtible feature off - i get about 5000 resync tries in watching the TS with Xine.

the code i'am using for testing purposes is attached and also available from cvs.tuxbox.org/apps/dvb/tools/dvb_test.

The output from dmesg after Oopsing is :

bad: scheduling while atomic!
Call Trace:
 [<c011c66b>] schedule+0x6a3/0x6a8
 [<c038c7c0>] play_audio_cb+0x84/0x14f
 [<c038c826>] play_audio_cb+0xea/0x14f
 [<c038bef4>] av7110_pes_play+0x2c/0x1ba
 [<c011c6b3>] default_wake_function+0x0/0x12
 [<c039087d>] gpioirq+0x3ac/0xb92
 [<c0393126>] send_ipack+0x93/0x20c
 [<c03933b3>] write_ipack+0xcb/0xfd
 [<c039370f>] av7110_ipack_instant_repack+0x32a/0x707
 [<c038d5a0>] av7110_write_to_decoder+0xa5/0x112
 [<c0381b7f>] dvb_dmx_swfilter_packet+0x22d/0x274
 [<c0381d53>] dvb_dmx_swfilter+0x100/0x178
 [<c0382f23>] dvbdmx_write+0x85/0xb7
 [<c037f642>] dvb_dvr_write+0x79/0x9c
 [<c037f5c9>] dvb_dvr_write+0x0/0x9c
 [<c015877d>] vfs_write+0xb0/0x119
 [<c015888b>] sys_write+0x42/0x63
 [<c0109017>] syscall_call+0x7/0xb

anybody you can help me out of this?

thx
mws
/*
 * test_dvr_play.c - Play TS file via dvr device.
 *
 * Copyright (C) 2000 Ralph  Metzler <ralph@convergence.de>
 *                  & Marcus Metzler <marcus@convergence.de>
 *                    for convergence integrated media GmbH
 * Copyright (C) 2003 Convergence GmbH
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2.1
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 */

#include <sys/ioctl.h>
#include <stdio.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include <sys/poll.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>

#include <linux/dvb/dmx.h>


#define BUFSIZE (512*188)

void play_file_dvr(int filefd, int dvrfd)
{
	char buf[BUFSIZE];
	int count, written, bytes, total = 0;

	while ((count = read(filefd, buf, BUFSIZE)) > 0) {
		total += count;
		fprintf(stderr, "read  %d (%d total)\n", count, total);
		written = 0;
		while (written < count) {
			bytes = write(dvrfd, buf + written, count - written);
			fprintf(stderr, "write %d\n", bytes);
			if (bytes < 0) {
				perror("write dvr");
				return;
			}
			else if (bytes == 0) {
				fprintf(stderr, "write dvr: 0 bytes !");
				return;
			}
			written += bytes;
		}
	}
}

void set_pid(int fd, int pid, int type)
{
	struct dmx_pes_filter_params pesFilterParams;

	fprintf(stderr, "set PID 0x%04x (%d)\n", pid, type);
	if (ioctl(fd, DMX_STOP) < 0)
		perror("DMX STOP:");

	if (ioctl(fd, DMX_SET_BUFFER_SIZE, 64*1024) < 0)
		perror("DMX SET BUFFER:");

	pesFilterParams.pid = pid;
	pesFilterParams.input = DMX_IN_DVR;
	pesFilterParams.output = DMX_OUT_DECODER;
	pesFilterParams.pes_type = type;
	pesFilterParams.flags = DMX_IMMEDIATE_START;
	if (ioctl(fd, DMX_SET_PES_FILTER, &pesFilterParams) < 0)
		perror("DMX SET FILTER");
}

int main(int argc, char **argv)
{
	char *dmxdev = "/dev/dvb/adapter0/demux0";
	char *dvrdev = "/dev/dvb/adapter0/dvr0";
	int vpid, apid;
	int filefd, dvrfd, vfd, afd;

	if (argc < 4) {
		fprintf(stderr, "usage: test_dvr_play TS-file video-PID audio-PID\n");
		return 1;
	}
	vpid = strtoul(argv[2], NULL, 0);
	apid = strtoul(argv[3], NULL, 0);

	filefd = open(argv[1], O_RDONLY);
	if (filefd == -1) {
		fprintf(stderr, "Failed to open '%s': %d %m\n", argv[1], errno);
		return 1;
	}

	fprintf(stderr, "Playing '%s', video PID 0x%04x, audio PID 0x%04x\n",
			argv[1], vpid, apid);

	if (getenv("DEMUX"))
		dmxdev = getenv("DEMUX");
	if (getenv("DVR"))
		dvrdev = getenv("DVR");

	if ((dvrfd = open(dvrdev, O_WRONLY)) == -1) {
		fprintf(stderr, "Failed to open '%s': %d %m\n", dvrdev, errno);
		return 1;
	}

	if ((vfd = open(dmxdev, O_WRONLY)) == -1) {
		fprintf(stderr, "Failed to open video '%s': %d %m\n", dmxdev, errno);
		return 1;
	}
	if ((afd = open(dmxdev, O_WRONLY)) == -1) {
		fprintf(stderr, "Failed to open audio '%s': %d %m\n", dmxdev, errno);
		return 1;
	}

	/* playback timing is controlled via A/V PTS, so we cannot start
	 * writing to the DVR device before the PIDs are set...
	 */
	set_pid(afd, apid, DMX_PES_AUDIO);
	set_pid(vfd, vpid, DMX_PES_VIDEO);

	play_file_dvr(filefd, dvrfd);

	close(dvrfd);
	close(afd);
	close(vfd);
	close(filefd);
	return 0;
}


Home | Main Index | Thread Index